Windows, home computer use: command prompt file operations: xcopy
Maintaining a home computer requires frequent self-tutoring. The tutor shares.
This Windows 7 computer no longer performs the COPY command from the mouse, so I use the command prompt to copy files, etc.
Lately I’ve been backing up directories, which contain subdirectories and so on. (Directory can also be thought of as Folder.)
To copy an entire directory, including its subdirectories and the folders contained therein, I use the xcopy command:
xcopy source_directory destination_directory /e
or
xcopy source_directory destination_directory /s
With /e it copies the empty folders, but not with /s.
In my experience, assigning a destination directory is important, since xcopy doesn’t copy the enclosing directory itself, just its contents. So, for instance, if you want to copy the directory desktop0 to a backup called desktop0, you might key
xcopy the_source_path\desktop0 the_destination_path\desktop0 /e
Observations:
- Although you can use the forward slash to navigate in Windows, it can’t (in my experience) be used in paths in Windows commands. Rather, the backslash must be. For instance,
topdir\dir1\dir2must be used, rather thantopdir/dir1/dir2, within a file command such asxcopy. However, for switches such as/sor/e, the forward slash is used. -
You can’t use
xcopyfrom within a directory you’re telling it to copy. I typically do it from the one above.
Source:
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.