Right now I use the code below to rename .dat to .txt files and it works fine as long as I'm running the macro on the same day as I receive the files. What I'm looking for, is a way to rename the files to text and keep the original file name, regardless of what day the macro runs.
These are examples of the files I receive daily:
MonthDayYear and file name
06012011_A_newbiz.dat
06012011_C_newbiz.dat
06012011_D_newbiz.dat
**This is the code that I use currently to rename the files to text and keep the original name**
//Rename from .DAT to .TXT
Year>yyyy
Month>mm
Day>dd
RenameFile>C:\NewBusiness\%mm%%dd%%yyyy%_A_newbiz.dat,C:\NewBusiness\%mm%%dd%%yyyy%_A_newbiz.txt
RenameFile>C:\NewBusiness\%mm%%dd%%yyyy%_C_newbiz.dat,C:\NewBusiness\%mm%%dd%%yyyy%_C_newbiz.txt
RenameFile>C:\NewBusiness\%mm%%dd%%yyyy%_D_newbiz.dat,C:\NewBusiness\%mm%%dd%%yyyy%_D_newbiz.txt
In short, if a file comes over today as 06012011_A_newbiz.dat...
I want to be able to rename that file to 06012011_A_newbiz.txt regardless of what day the macro runs.
I've been stuck on this for awhile now so any help would be MUCH appreciated!
Rename All files to .txt and keep original filenames
Moderators: Dorian (MJT support), JRL
If the file names are as simple as your samples you can probably just use the DOS ren command.
Code: Select all
Let>RP_WAIT=1
Run>cmd /c ren C:\NewBusiness\*.dat *.txt