failed
asked on
Copy files based on file name script
Hi Experts
I am looking for a script to run under Windows XP/Server 2003 which will copy and move files to a location determined by their name and alter their file extension.
Basically It has to be triggered by a .bat file but I can call a VBScript etc from within the batch
example:
in c:\testing\
12345678_ordrsp.128475
12345678_ordrsp.178548
56789101_ordrsp.787955
Two variables are:
%customer%
%messagetype%
These are as follows in example:
12345678 and 56789101 are the %customer%, these are always the first characters before the first underscore
ordrsp is the %messagetype% - these are always the 6 characters after the first _
Step 1
Files should end up with the . changed to _ and having .xml at the end
12345678_ordrsp_128475.xml
12345678_ordrsp_178548.xml
56789101_ordrsp_787955.xml
Step 2
Copy the files to c:\testing\backup\%custome r%\%messag etype%
Step 3
Move the files to c:\testing\outbound\%custo mer%\%mess agetype%
Not essential but if the folders with the values behind %customer% and %messagetype% did not exist then it would be useful the script would create them.
HELP :)
ps. To get the examples uploaded I had to rename them .bmp as EE wont allow the extension types .128475 etc
testing.zip
I am looking for a script to run under Windows XP/Server 2003 which will copy and move files to a location determined by their name and alter their file extension.
Basically It has to be triggered by a .bat file but I can call a VBScript etc from within the batch
example:
in c:\testing\
12345678_ordrsp.128475
12345678_ordrsp.178548
56789101_ordrsp.787955
Two variables are:
%customer%
%messagetype%
These are as follows in example:
12345678 and 56789101 are the %customer%, these are always the first characters before the first underscore
ordrsp is the %messagetype% - these are always the 6 characters after the first _
Step 1
Files should end up with the . changed to _ and having .xml at the end
12345678_ordrsp_128475.xml
12345678_ordrsp_178548.xml
56789101_ordrsp_787955.xml
Step 2
Copy the files to c:\testing\backup\%custome
Step 3
Move the files to c:\testing\outbound\%custo
Not essential but if the folders with the values behind %customer% and %messagetype% did not exist then it would be useful the script would create them.
HELP :)
ps. To get the examples uploaded I had to rename them .bmp as EE wont allow the extension types .128475 etc
testing.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Isn't this question a duplicate of https://www.experts-exchange.com/questions/26841457/batch-script-for-creating-folders-and-moving-files.html ?
~bp
~bp
CopyFiles.cmd has to be stored in a different path (not in c:\testing)!!!
Open in new window
CopyFiles.cmd