1

I recently backed up the data on my computer, using the xcopy command. I briefly looked through some of my backup files and directories, and they looked the same as the originals. However, I understand that some people use backup wizards instead of xcopy, and I was wondering whether xcopy provides a safe means of backing up data.

I typed the following command in the Windows command prompt terminal:

xcopy [Source] [Destination] /s /e /v

My source was my home directory on my hard drive. (My hard drive is not partitioned, and I have only one home directory.) My destination was a new directory to be created on a flash drive. After typing the command, I was asked whether the destination was a directory or a file, and I indicated a directory. I used the "/s"-option to copy subdirectories. I used the "/e"-option to copy empty directories. I used the "/v"-option to verify that all copies were the same as the originals. There were no encrypted files to copy.

For the parameters that I included in my command, I believe the correct order was, "/s /e /v". However, I do not remember for certain that this was the order which I used. Does the order of these parameters matter?

Because my source was my home directory, I know that I did not create any backups of software on my computer. However, I only wanted to back up my data, not software.

I understand that there is a "/h"-option to copy hidden files. I did not include this option, since none of my data would be in hidden files, and I read that it is best to leave hidden files alone. I understand that hidden files are created by Windows for the purpose of running the operating system and programs, and are hidden so that users do not unintentionally fiddle with them.

I backed up my data, because I am planning on installing Ubuntu on my computer. To be safe, I created several backups, each on a different flash drive. I understand that I should periodically back up my data, and I plan to do that after I install Ubuntu. Since my data are saved in Windows directories, I understand that I might need to use Wine to access my data from Ubuntu.

Before I attempt the installation, I thought I should ask whether my method of using the xcopy command was safe. Would my command be expected to copy all of my data from my home directory? Would the process have stopped and given me an error message if a file or subdirectory had not been copied correctly? Is there any reason to use a backup wizard instead?

Thank you.

1 Answers1

-1

After studying this issue some more, I believe the solution is to first run the xcopy command I posted, and then to run the following command:

echo %ERRORLEVEL%

I believe the above command would output the error level generated by xcopy. An output of zero from the echo command would mean that there were no errors in running xcopy, and the copy was successful.

Since my xcopy command includes the attributes, "/s /e /v", all subdirectories and their contents are copied, and copies are verified to be identical to originals.

I found out about the command, "echo %ERRORLEVEL%", from the following source:

https://www.computerhope.com/jargon/e/erroleve.htm#testing-errorlevel

I deleted a recent backup from a flashdrive, I created a new backup with the xcopy command I described, and I ran the echo command. The echo command returned the value of zero, which I believe means that there were no errors in making the copy. So, I believe the copy was successful.

@SenorCMasMas: I tried your suggestion of using robocopy. However, the robocopy command transferred files from directories I could only see by typing, "dir /a". I believe these must have been system and hidden files. Robocopy got stuck trying to transfer a certain file from a hidden directory, and I aborted the process with "Ctrl-C". I believe administrator privileges probably were required for transferring the file. However, I did not try running the command prompt as an administrator, because I only want to back up my data, and I do not want to transfer system files and hidden files. I understand that robocopy can exclude the transfer of certain types of files when used with the parameter, "/xa:". I tried using this parameter to exclude system files and hidden files, but robocopy still would transfer files from hidden directories, and then would get stuck on one such file. I tried "/xa: s" to exclude system files, "/xa: h" to exclude hidden files, "/xa: sh", and "/xa: s /xa: h". The same problem came up every time.

I did some reading on robocopy, and I understand the primary advantage of the command is that it allows one to transfer directories and files without altering ones which had been transferred earlier. I am trying to create a backup for the first time. So, I do not see why I would need to use robocopy. I believe the xcopy command would be fine for my purposes.

@JW0914: You said that both xcopy and robocopy are inefficient, and there is no guarantee of data integrity. Not much data are saved on my computer right now, and xcopy did not take an unreasonable amount of time. So, I do not think I need to worry about efficiency. Since I used the "/v"-parameter, xcopy verified that the copies were identical to the originals. Since my "echo %ERRORLEVEL%" command output no error messages, I believe there were no errors in copying my data. So, I do not believe there should be any problem with data integrity.

You said that one should not use Linux to back up Windows. I am not trying to use Linux to back up Windows. I have experience with Linux, and I prefer that operating system. I should have installed Linux as soon as I got my computer, but I did not. That is why I have data in my Windows system. I now want to install Linux, but I first need to make sure my data are safely backed up.

Thank you to both SenorCMasMas and JW0914. I appreciate your input. I would appreciate any additional input you might have to offer, as well as input from others.