Computing.Net > Forums > Windows 95/98 > batch file copy/rename foldername+#

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file copy/rename foldername+#

Reply to Message Icon

Name: barberboy
Date: June 14, 2005 at 12:34:13 Pacific
OS: win98se
CPU/Ram: p4/128
Comment:

I need help writing a batch file that will copy folders and files from one directory to another directory and rename the files. I am scanning files into Dir1 in several different folders that i create when i scan, and after the files are scanned i want to run a batch file that will copy the folders and files into Dir2 and change the filename to it's foldername+a unique number. For instance, the batch file would copy and rename the files:

Dir1\999999999\Page 1.max
Dir1\999999999\Copy of Page 1.max
Dir1\888888888\Page 1.max
Dir1\888888888\Copy of Page 1.max
Dir1\888888888\Copy(2) of Page 1.max

to

Dir2\999999999\999999999_1.max
Dir2\999999999\999999999_2.max
Dir2\888888888\888888888_1.max
Dir2\888888888\888888888_2.max
Dir2\888888888\888888888_3.max

Once the folders and files are copied and renamed, the folders/files on Dir1 will be deleted, either by a prompt within this batch file or a different batch file. It doesn't really matter. Usually the folders (999999999, etc) will be unique and not on Dir2 when this batch file is run, but occasionally a folder will already be present on Dir2. If that is the case, it would be great if the files could be copied into the folder without overwriting any existing files. For instance, if 888888888\Page 1.max was copied over to Dir2, it would have the name 888888888\888888888_4.max if there was already a _1, _2, and _3.

I hope this is possible, but i don't have enough experience with batch files to know if you can name a file it's foldername and/or have consecutive numbering of files in a folder without overwriting. Any feedback on this would be great.

Thanks alot.

Ben



Sponsored Link
Ads by Google

Response Number 1
Name: ham30
Date: June 14, 2005 at 15:16:18 Pacific
Reply:

The Dos forum has some batch file wizards.


0

Response Number 2
Name: hiho
Date: June 15, 2005 at 00:47:52 Pacific
Reply:

This is not a STANDALONE DOS FORUM question as per warnings that the forum is not for the COMMAND PROMPT in WINDOWS.


0

Response Number 3
Name: Derek
Date: June 15, 2005 at 08:29:48 Pacific
Reply:

Might be worth Googling around to see if there is a DOS/Batch file forum somewhere. Many of us dabble with batch files but this one looks like the province of an expert.

In the meantime keep an eye on here just in case the right person comes along.

Derek.W


0

Response Number 4
Name: barberboy
Date: June 15, 2005 at 10:11:45 Pacific
Reply:

Believe me, i have been googling for quite a while on this and not found anything that will work for me. And this site seemed to be the most likely to catch the eye of someone who could answer my question.

I tried to post this in the DOS forum since that is where most of the batch questions have been addressed, but it was removed. I guess it would probably be best to post it in the programming forum if i want to catch the eye of someone most capable to answer my question.

Is it possible to have a moderator move this post to the Programming forum? I would hate to repost the same message as that is not only rude, but possibly against forum regulations.

Thanks for the suggestions.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Laptop not booting into w... Dell Laptop no audio



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 95/98 Forum Home


Sponsored links

Ads by Google


Results for: batch file copy/rename foldername+#

Simple (?) Batch File to Rename Files www.computing.net/answers/windows-95/simple-batch-file-to-rename-files/49929.html

renaming batch files www.computing.net/answers/windows-95/renaming-batch-files/156231.html

Win9x Batch file questions www.computing.net/answers/windows-95/win9x-batch-file-questions/131749.html