batch to copy files with xcopy

后端 未结 4 1562
青春惊慌失措
青春惊慌失措 2021-02-09 07:02

I have checked some examples on internet but I can\'t get my (first) batch file to work. I would like to copy automatically my file from a folder to another one but nothing happ

相关标签:
4条回答
  • 2021-02-09 07:37

    After testing most of the switches this worked for me:

    xcopy C:\folder1 C:\folder2\folder1 /t /e /i /y
    

    This will copy the folder folder1 into the folder folder2. So the directory tree would look like:

    C:
       Folder1
       Folder2
          Folder1
    
    0 讨论(0)
  • 2021-02-09 07:40

    If the requirement is to copy all files in "\Publish\Appfolder" into the parent "\Publish\" folder (inclusive of any subfolders, following works for me) The switch '/s' allows copying of all subfolders, recursively.

    xcopy src\main\Publish\Appfolder\*.* /s src\main\Publish\

    0 讨论(0)
  • 2021-02-09 07:40

    You must specify your file in the copy:

    xcopy C:\source\myfile.txt C:\target
    

    Or if you want to copy all txt files for example

    xcopy C:\source\*.txt C:\target
    
    0 讨论(0)
  • 2021-02-09 07:47

    Based on xcopy help, I tried and found that following works perfectly for me (tried on Win 7)

    xcopy C:\folder1 C:\folder2\folder1 /E /C /I /Q /G /H /R /K /Y /Z /J
    
    0 讨论(0)
提交回复
热议问题