Windows BAT File to Rename File Depending on Target Directory - MS-DOS
This is a discussion on Windows BAT File to Rename File Depending on Target Directory - MS-DOS ; Hello, I would like to create a BATCH file which will move and rename a file depending if a file already is present on the target directory. For example Directory 1 contains a file called "TEST_00.TXT". Directory 2 contains a ...
| | LinkBack | Tools |
|
#1
| |||
| |||
| I would like to create a BATCH file which will move and rename a file depending if a file already is present on the target directory. For example Directory 1 contains a file called "TEST_00.TXT". Directory 2 contains a file called "TEST_00.TXT" already. TEST_00.TXT from directory 1 needs to be moved to directory 2 and the filename needs to be incremented by 1 if a file with the same name already exists. In this example the file would be moved to directory 2 and the file renamed by the batch to "TEST_01.TXT". Is this possible? Thanks, Brett |
|
#2
| |||
| |||
| On Thu, 10 Jan 2008 05:51:21 -0800 (PST), brettmanning24@gmail.com wrote in comp.os.msdos.programmer: > Hello, This group is about MS-DOS, not about Windows. If you want to ask about a batch file for MS-DOS, this is the place. If you want to ask about a batch file for Windows, this is not the place. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html |
|
#3
| |||
| |||
| On Jan 10, 8:51 am, brettmannin...@gmail.com wrote: > Hello, > > I would like to create a BATCH file which will move and rename a file > depending if a file already is present on the target directory. For > example > > Directory 1 contains a file called "TEST_00.TXT". > > Directory 2 contains a file called "TEST_00.TXT" already. > > TEST_00.TXT from directory 1 needs to be moved to directory 2 and the > filename needs to be incremented by 1 if a file with the same name > already exists. In this example the file would be moved to directory > 2 and the file renamed by the batch to "TEST_01.TXT". > > Is this possible? > > Thanks, > > Brett Depending on version of DOS it may be possible, I would recommend you get a 'batch enhancer' like "BE" and check out Timo's stuff from Vassa Finland. Using 'IF' and 'GOTO' with a predetermined list is a bit tedious, but I did that 20 years ago, and it does work. Hope that helps, Mark Whitlock. P.S. Windows and dos after 6 have an 'IF EXISTS' command. |
« Previous Thread
|
Next Thread »
| Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows BAT File to Rename File depending if file exists in targetDirectory | unix | MS-DOS | 13 | 01-24-2008 04:18 PM |
| Rename current file in directory | unix | MS-DOS | 4 | 01-16-2008 01:38 PM |
| File operation (rename,remove,fopen) fail on Windows XP | unix | Programmer | 0 | 10-04-2007 05:33 PM |
| Re: How will I rename every file in a directory to their filenames | unix | FreeBSD | 0 | 02-04-2005 08:28 AM |
| How will I rename every file in a directory to their filenames | unix | FreeBSD | 0 | 02-04-2005 08:24 AM |
All times are GMT. The time now is 09:33 PM.
