|Hi, I'm trying to write a script file and looking for some help. I have a directory that has 3 text files in it. I need to loop thru the directory, and for each file append today's date to the file name. For example, I have file W800.txt. I want to rename this: W800_10122010.txt or some other acceptable version of the date. I can do individual files but can't figure out how to loop thru the directory and rename multiple files. The code I'm using is:|
FOR %%T in (%SourceFileLocation%*.txt) DO REN %%T "_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%_%time:~3,2%_%time:~6,5%.txt"
The script is going to be called by another procedure, so we don't want to manually enter in anything to execute.
All this code does is renames the first file in the directory with just the date and then errors out "A duplicate file name exists or the file cannot be found". Any help would be greatly appreciated!!!