Computer Hope

Hardware => Drivers => Topic started by: Hilburn245 on December 08, 2020, 12:41:15 AM

Title: copying all contents of folder to another folder using batch file?
Post by: Hilburn245 on December 08, 2020, 12:41:15 AM
I have a folder in C:\Folder1

I want to copy all the contents of Folder1 to another location, D:\Folder2

How do I do this using a batch file?
Title: Re: copying all contents of folder to another folder using batch file?
Post by: DaveLembke on December 09, 2020, 08:47:24 PM
xcopy c:\folder1\*.* d:\folder2\*.* /s/d/y/h


add the above to notepad and save it as whatever you want it named as such as movedata.bat with .bat file extension and this will copy all contents from c:\folder1 to d:\folder2. Make sure the batch file when run it is not located at c:\folder1 or else you could have an issue due to the file being open. That being said all data that is at c:\folder1 should be not opened by any applications to avoid problems with file in use during copy.

If folder1 and folder2 were just for example purposes but the path is different you can change the instruction to those specific paths; however if your going to target a folder that has files in use you will run into problems!
Title: Re: copying all contents of folder to another folder using batch file?
Post by: patio on January 11, 2021, 06:50:34 AM
SPAM Removed...

Topic Closed.