We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

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

Matthew Emery
on
132 Views
Last Modified: 2017-03-08
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"
Comment
Watch Question

Datacenter platform engineer Lindows
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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?
Patrick BogersDatacenter platform engineer Lindows
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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 BogersDatacenter platform engineer Lindows
CERTIFIED EXPERT

Commented:
Cheers buddy
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.