Add prefix to file name while copying

August 20, 2011 at 09:35:05
Specs: Windows Vista
Can anyone please help me with a script for Adding a prefix to file name while copying

Lets say i want to copy a file named test1.txt, when the file is copying to the destination location it will looks like test1.txt_ (with underscore at the end of the file)

When the file is completed copying it will be the actual file name test1.txt (the underscore was removed)

Any help is highly appreciated

Thanks in advance.
Bulan


See More: Add prefix to file name while copying

Report •

#1
August 20, 2011 at 10:52:05
It probably isn't worth it, because you will have to put in an additional 2 lines of code for each file you are copying. You can't put the underscore in the .TXT area, but you can put it like TEST1_.TXT:

REN TEST1.TXT TEST1_.TXT
COPY TEST1_.TXT <Destination Folder Here>
REN TEST1_.TXT TEST1.TXT

Why do you need to rename the files though if they get renamed to the original name in the first place?

Mouse could not be found. Click OK to continue.
What to do now?


Report •

#2
August 20, 2011 at 13:12:48
The reason is we have another batch job running on the other side, that will download the files (without underscore), so when they see the files with (_) extension they will ignore it.

I know it's a bit tricky but i have see it somewhere just i can't remembered. Thanks buddy for the reply ;)


Report •

#3
August 20, 2011 at 13:21:52
Okay, then you will have to pretty much use that code, and I think that is about all you can do. You will have to repeat the code for each file for what I know at least. You might want to take a look at the XCOPY command, which has many more features. Just open command prompt and enter XCOPY /? and you'll see everything you can do with it.

Mouse could not be found. Click OK to continue.
What to do now?


Report •
Related Solutions


Ask Question