I want to use a Windows batch file to copy a file (myfile0001.bdg) from one specific directory to another. But I want to check if the file exists in the destination directory, and if the answer is yes, increase the file to 0001 and check again if the file exists (myfile0002.bdg), etc. While the file does not exist, and copy the file with a new name.
So, if in the destination directory I have these files:
myfile0001.bdg
myfile0002.bdg
myfile0003.bdg
myfile0004.bdg
myfile0005.bdg
myfile0006.bdg
The new file should be named myfile0007.bdg. The next time I run the package, the new file will be myfile0008.bdg, etc.
I know that there is an IF EXIST command, but I don’t know what to do, what I need.
===============
- I'm on Windows 7 x32
- : "C:\USERS\RAMBYTES\DOCUMENTS \"
- : "P:\BACKUP \"
- "MYFILE0001.BDG"