I have many files (ie, don.mig, dan.mig, jon.mig, etc.) in a folder name "migrate".
I want to process each file and then rename each of file (ie, don.mig = don.mig.done) until all the files with the .img extension is done in this folder
I am think of using the While statement but not sure of the syntax. In another words, what is the syntax for the statement
While existing *.mig file
process1
process2
rename file
endwhile
Please help
The function you are looking for is FileItemize or FileItemPath. Here is an example that uses FileItemize:
dir = "C:\TEMP\"; or use DirScript() for the current working directory of the script.
DirChange( dir ) ; Important: must change the working directory to root dir.
filelist = FileItemize('*.mig') ; Returns a tab delimited list of all file names matching the wildcard.
For i = 1 to ItemCount(filelist, @tab) ; Iterate thru tab delimited list
filename = ItemExtract( i, filelist, @tab ) ; Extract th items in order
newfilename = filename:'.done'
FileRename( filename, newfilename ) ; Rename the file
Next
Exit
That works !!!
but, the newfilename = filename:'.done' posting an error message 3074: Expression continues past expected end.
I am using winbatch 32 2002B.
any ideas??
mtruong1
That older version doesn't support the colon concatenation operator. you will need to use StrCat instead:
newfilename = StrCat( filename, '.done' )