Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: copying all contents of folder to another folder using batch file?  (Read 91587 times)

0 Members and 1 Guest are viewing this topic.

Hilburn245

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    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?

    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: copying all contents of folder to another folder using batch file?
    « Reply #1 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!

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: copying all contents of folder to another folder using batch file?
    « Reply #2 on: January 11, 2021, 06:50:34 AM »
    SPAM Removed...

    Topic Closed.
    " Anyone who goes to a psychiatrist should have his head examined. "