Batch file needed to automatically rename files sequentially.
Posted on 2007-08-02
I am getting a log file from my server every 5 minutes for diagnostic purposes. The files are copied into a folder and then sent out via FTP. My problem is that I need to rename the files in the 5 minutes that they are sitting in the folder - called "testfolder" - so that they are unique. I would like to append the time of day to each file, or simply add a numerical sequence to them. E.g., "testfile.csv" becomes "testfile08_03_2007_14_21_33.csv". The "14_21_33" being 14 hours (2 PM), 21 minutes and 33 seconds. Alternatively, the file could simply be renamed "testfile001.csv". There are numereous utilites for renaming files manually, or for renaming multiple files, but what I need is a batch file that will do the job automatically 24/7. I need to come in every morning and find a folder with files that I can distinguish from one another by sight. If I'm out of the office overnight then I should find over 100 files in the morning that I can compare based on their names. Thaniks for any help coding a solution for this.