Tech Support Forum banner

XCopy Command Line Problem - Help Please - What am I doing wrong?

3.3K views 4 replies 3 participants last post by  WndrWmn  
#1 · (Edited)
Hello,

Important Note: I suck at command line everything.......I am spoiled to Windows GUI.....

I am trying to copy both a .zip and a separate folder of the extracted contents from my desktop (Win11 Pro) to a USB external HD attached on the back of my NAS enclosure. The zip and the extracted are both extremely large (tons of folders, sub folders and files) I am running into the typical "long path" and "long file name" error....I have already checked my registry for the long paths registry hack and it is already enabled. I think extremely like an administrative assistant using physical filing cabinets when I name folders and files on my computers which is why you will see spaces in the folder & file names.

I am trying to use XCopy but I keep getting errors about the invalid number of parameters.......I have already been to Chat GPT and been given several suggestions but none of them are working. Here's what I've tried already:

xcopy <C:\Users\amazo\Desktop\original-scrape /e/h/c/i [<X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023>]

xcopy original-scrape X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023

xcopy original-scrape\* X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023

I have also tried using RoboCopy but I am getting a similar error:

robocopy "C:\Users\amazo\Desktop\original-scrape\" "\\X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023" /e /copy:DAT /dcopy:T

ERROR : Invalid Parameter #5 : "Agencies\USAR"

Apparently I am having problems with the commands not liking the spaces in the folder name for USAR And Their Agencies and I don't know how to get around that other than to rename the folder which is too easy an answer....I don't want an easy answer I want to know what I am doing wrong....

I am really intent on getting past my "I suck at command line" and this will further my learning....

Thank you.

Sincerely,
WndrWmn
 
#3 · (Edited)
I got RoboCopy to work....I did some research and discovered that there needs to be an extra space at the end of the source & destination paths and before the closing quotation mark.....My big question now becomes this (since I don't need to do a duplicate copy) do I need the quotation marks and the spaces before the closing quotation marks for XCopy to work also?
 
#4 ·
Hello WndrWmn,
It's great that you're determined to overcome command line challenges! The issue you're facing is related to spaces in folder names, and it requires a bit of tweaking in the way you structure your commands. Here's a suggestion for both XCopy and RoboCopy:
XCopy:
batchCopy code
xcopy "C:\Users\amazo\Desktop\original-scrape" "X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023" /e /h /c /i

Key points:
  • Wrap paths containing spaces with double quotes.
  • Include the trailing backslash for the source path.
  • Use switches like /e, /h, /c, and /i to copy subdirectories, include hidden and system files, continue copying even if errors occur, and assume destination is a directory.
RoboCopy:
batchCopy code
robocopy "C:\Users\amazo\Desktop\original-scrape" "X:\Scraping Project\2023\USAR And Their Agencies\USAR DOJ Full Site DL\WGET Recursive\RPF Scrape Versions\11-05-2023" /e /copy:DAT /dcopy:T

Key points:
  • Similar to XCopy, use double quotes for paths with spaces.
  • /e copies subdirectories, including empty ones.
  • /copy:DAT specifies data, attributes, and timestamps to copy.
  • /dcopy:T copies directory timestamps.
These commands should handle spaces in the folder names correctly. Give them a try, and if you encounter any issues or have additional requirements, feel free to ask for further assistance.
Best of luck with your command line endeavors!
Sincerely,
Alex Taylor
 
#5 ·
Alex,

Thank you so much for helping me with that syntaxing, I really appreciate it. Do you happen to know of any books that can educate me on all of the nuances for command line? I don’t care if they are really old books published back in the caveman days so to speak this information hasn’t changed and will not and cannot change.

I am talking about the basics like when spaces are needed, or cannot be used at all, how to get my file and folder names, which use spaces in them to be accepted and functional, as well as differences between forward and backslashes, and when each one is supposed to be used.

I also and I am embarrassed about this one, but it is frustrating me to no end always having problems with changing directories. I have my command prompt set to always open at elevated administrator level and I know that there are a lot of different possible methods that can be used to change directories. The ones that I am aware of include simply putting the letter with a colon or using the command CD, then a space, and then the letter with a colon and a backlash, but I am always winding up having problems where it just doesn’t work and I have to try multiple methods to get it to work finally.

A perfect example is when I open the command prompt window. It opens to the system 32 directory and if I want to just simply go to the root directory, which is simply C: or C:\ it doesn’t work I then have to try resorting to CD <Space> C:\ to change to the root directory. I might be getting a couple of them a little bit backwards. I am not by my computer right now as I’m writing this. I’m on my iPad dictating this, so I don’t remember exactly which one actually winds up working.

I always have to rotate around because I never know which one is going to wind up working. It’s all because when I started my computer career I never started on DOS. I started on a Mac computer with System 7 which already had a mouse and was just like Windows still is; an operating system that I call “you want it, you see it, you click it” and therefore I never learned any of my command line syntaxing with spaces and slashes and changing directories. This is why I’m looking for any kind of a basic book that might be recommended and if not a basic book, maybe a website that can help.

Thank you.