xcopy /e/h/y /z/i /k /f src dest

# Copy directories and files just like

I can remember "cp -av" on Unix like systems to copy files and directories. The same can be done on Windows without extra software, somewhat. The switches mean: /E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. /H Copies hidden and system files also. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. /I If destination does not exist and copying more than one file, assumes that destination must be a directory. /K Copies attributes. Normal Xcopy will reset read-only attributes. /F Displays full source and destination file names while copying. I don't type that all the time, I stick it into a file called "cpav.cmd" and run that. echo xcopy /e/h/y /z/i /k /f %1 %2 > cpav.cmd cpav zsh zsh2 http://support.microsoft.com/kb/323007
Sample Output
$cpav.cmd zsh zsh2 Z:\piyo\AppPrefs\zsh\.zlogin -> Z:\piyo\AppPrefs\zsh2\.zlogin Z:\piyo\AppPrefs\zsh\.zprofile -> Z:\piyo\AppPrefs\zsh2\.zprofile Z:\piyo\AppPrefs\zsh\.zshenv -> Z:\piyo\AppPrefs\zsh2\.zshenv Z:\piyo\AppPrefs\zsh\.zshrc -> Z:\piyo\AppPrefs\zsh2\.zshrc Z:\piyo\AppPrefs\zsh\dot-zsh-check.sh -> Z:\piyo\AppPrefs\zsh2\dot-zsh-check.sh Z:\piyo\AppPrefs\zsh\notes.txt -> Z:\piyo\AppPrefs\zsh2\notes.txt 6 File(s) copied -3 2009-02-13 16:25:09 ## These Might Interest You • This command will copy files and directories from a remote machine to the local one. Ensure you are in the local directory you want to populate with the remote files before running the command. To copy a directory and it's contents, you could: ssh user@host "(cd /path/to/a/directory ; tar cvf - ./targetdir)" | tar xvf - This is especially useful on *nix'es that don't have 'scp' installed by default. 1 ssh user@host "(cd /path/to/remote/top/dir ; tar cvf - ./*)" | tar xvf - · 2009-03-31 13:08:45 • I used this command to recursively gather all mp3 files that were previously imported into their own directories (sorted by band name) in Songbird. 1 find . -name '*.mp3' -type f -exec sh -c 'exec cp -f "$@" /home/user/dir' find-copy {} +
· 2009-12-08 19:31:16
• If you have lots of remote hosts sitting "behind" an ssh proxy host, then there is a special-case use of "rsynch" that allows one to easily copy directories and files across the ssh proxy host, without having to do two explicit copies: the '-e' option allows for a replacement "rsh" command. We use this option to specify an "ssh" tunnel command, with the '-A' option that causes authentication agent requests to be forwarded back to the local host. If you have ssh set up correctly, the above command can be done without any passwords being entered.

5
rsync -avz -e 'ssh -A sshproxy ssh' srcdir remhost:dest/path/
· 2009-03-25 21:29:07
• Let's say you have a set of files in tree A that you want duplicated to tree B while preserving their directory structure / hierarchy. (For example, you might want to copy your 'profile' model/views/controller from one Rails application to another.) The "pax" command will copy all matching files to the destination while creating any necessary directories.

0
cd ~/ruby/project_a ; find . -name "*profile*" -exec pax -rw {} ~/ruby/project_b/ \;
· 2011-11-10 21:18:15
• Useful when upgrading my Linux distro and trying to copy only "settings" from the old home folder to the new one.

0
rsync -a /path/from/.[^.]* /path/to
· 2012-03-19 22:08:54
• trying to copy all your dotfiles from one location to another, this may help Show Sample Output

-2
ls -a | egrep "^\.\w"
· 2009-11-11 18:19:56

### What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Find usb device
Juluan 25