XCopy won't copy the subfolders and if it does, they're empty

Page 1 of 2 12 LastLast

  1. Posts : 2
    Windows 10
       #1

    XCopy won't copy the subfolders and if it does, they're empty


    I have a list of 98 files with their exact directory. I want to copy said files to a new location, so I thought Xcopy would work for that but apparently not.

    The best result I could get was SOME of the subfolders would be created, but ALL of the files would be placed into the root destination directory and NOT in their subfolders so every subfolder in the destination was just empty and it only grabbed some of the subfolders for whatever reason.

    This is an example of my Xcopy code for one of the 98 files:

    xcopy "F:\Docs\Unreal Projects\Racer_Backup_2022_01_04\Content\1_Project\Meshes\Prefabs\CharacterShowcase_PF.uasset" "F:\Desktop2020\ModifiedFiles\" /e /i I've also tried other switches like /t /s etc. but it doesn't make a difference.

    I thought this would create the folders: Docs\Unreal Projects\Racer_Backup_2022_01_04\Content\1_Project\Meshes\Prefabs\ in the destination, but it doesn't. At best it only goes back one subfolder but places the file in the root F:\Desktop2020\ModifiedFiles". At worst, it doesn't even take the first subfolder and still places the files in F:\Desktop2020\ModifiedFiles\

    Any idea of a way to fix my Xcopy code?
      My Computer


  2. Posts : 5,328
    Windows 11 Pro 64-bit
       #2

    I have attached batch script which can total copy first and then incrementally, it just copies the new files and changed files.
    XCopy won't copy the subfolders and if it does, they're empty Attached Files
      My Computer


  3. Posts : 781
    Windows 10
       #3

    Hi @TorQueMoD.

    First, I would not recommend using xcopy for this I would rather use Copy-Item -Path in Powershell. In my opinion xcopy is best for smaller amounts of files.

    With Copy-Item -Path you can copy the entire parent folder. So you simply would do:
    Code:
    Copy-Item -Path F:\Docs\Unreal Projects\Racer_Backup_2022_01_04\Content\1_Project\Meshes\Prefabs\ -Destination F:\Desktop2020\ModifiedFiles\ -recurse -Force
    Hope this helps,
      My Computer


  4. Posts : 2
    Windows 10
    Thread Starter
       #4

    James said:
    Hi @TorQueMoD.
    ...Hope this helps,
    Thanks James. I'm noticing that you've removed the specific file name from the item path. There are actually multiple files in the folder, and I want to target just one file specifically. Is this possible with Copy Item, or do I have to grab everything in the folder?
    .
    .
    @FreeBooter - I can't download the file. It says "Failed - Forbidden"
      My Computer


  5. Posts : 2,137
    Windows 11 Pro (latest update ... forever anal)
       #5

    Robocopy (also built into Windows) also worth a look.
      My Computers


  6. Posts : 4,571
    several
       #6

    did you try xcopy /cheriky
      My Computer


  7. Posts : 5,328
    Windows 11 Pro 64-bit
       #7

    TorQueMoD said:
    Thanks James. I'm noticing that you've removed the specific file name from the item path. There are actually multiple files in the folder, and I want to target just one file specifically. Is this possible with Copy Item, or do I have to grab everything in the folder?
    .
    .
    @FreeBooter - I can't download the file. It says "Failed - Forbidden"
    It could be your antivirus causing download problem, i will upload script place in .Zip archive.
    XCopy won't copy the subfolders and if it does, they're empty Attached Files
      My Computer


  8. Posts : 456
    Windows 10
       #8

    I think it would be xcopy "F:\Desktop2020\ModifiedFiles" "D:\Desktop2020\ModifiedFiles" /e /i
      My Computer


  9. Posts : 4,571
    several
       #9

    I dont know what he is trying to do

    xcopy /cherikys "F:\Docs" "F:\Desktop2020\ModifiedFiles\Docs"

    would result in this:

    "F:\Desktop2020\ModifiedFiles\Docs\Unreal Projects\Racer_Backup_2022_01_04\Content\1_Project\Meshes\Prefabs\CharacterShowcase_PF.uasset"

    copies all the subfolders and files from under "F:\Docs" but its not clear if he wants all the subfolders copied and only that one file ( in case there are many other files )
      My Computer


  10. Posts : 456
    Windows 10
       #10

    @SIW2 cool didn't know you could use the xcopy switches like that "xcopy /cherikys" I was wondering if they added a new switch to xcopy I didn't know about...
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:37.
Find Us




Windows 10 Forums