Avatar of Matthew Emery
Matthew Emery
Flag 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"
Windows Batch

Avatar of undefined
Last Comment
Patrick Bogers

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Patrick Bogers

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
Patrick Bogers

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Matthew Emery

ASKER
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 :-)
Patrick Bogers

Cheers buddy
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23