Link to home
Create AccountLog in
Avatar of Matthew Emery
Matthew EmeryFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Help with a batch file please - Defining multiple source destinations & archiving

Hi All

I am creating a batch file that copies the contents of 3 folders to a single folder.

I have not got very far at the moment as:

1) I want to copy from 3 source locations to the same destination folder and not sure how to separate these into the code rather than using a repetition of code.  

2) After the files have successfully copied to the destination folder I would like to move them from the source folders completely and place them into a folder called ARCHIVE

This is where I am currently at:

copy /-y "C:\PO" "c:\ABSFiles"
ASKER CERTIFIED SOLUTION
Avatar of Patrick Bogers
Patrick Bogers
Flag of Netherlands image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Matthew Emery

ASKER

Hi Patrick

Sorry if this is being stupid but the move command works great but the files are not copied into the ABSFiles folder first, this is what I have got to:

Copy /y "C:\ABS\PO\*.*" "c:\ABSFiles"
Copy /y "C:\ABS\RETURN\*.*" "c:\ABSFiles"
Copy /y "C:\ABS\GRN\*.*" "c:\ABSFiles"
Move /y C:\ABS\PO\*.* C:\ABS\ABSArchive
Move /y C:\ABS\RETURN\*.* C:\ABS\ABSArchive
Move /y C:\ABS\GRN\*.* C:\ABS\ABSArchive

Open in new window


Also I am going to set this up as  scheduled task so does that mean I need to remove the Y function?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thank you so much Patrick.

The above did work perfectly it was my account having write permissions to the C drive so when I put this on the server all files copy and move as intended :-)
Cheers buddy