cp existing_file new_file
Copying Files (to CAEN)
-
In general, you can use the
cpcommand to copy local files:or directories:
cp -r existing_directory new_directorySimilarly can you use the
scpcommand to securely copy files or directories between a local computer and a remote server, such as CAEN. -
A better command is
rsync:rsync -a existing newSpecifying the
voption will produce verbose output, printing the names of files it copies:rsync -av existing new -
To copy a file or a directory to or from a remote server (such as CAEN), add your username (uniqname) followed by the host name of the remote server (e.g.,
login.engin.umich.edu). For example, this is how you could upload the contents of the current director (.) to some directory on CAEN:rsync -av . [email protected]:/path/to/directoryAnd this is how you could download the contents of some directory on CAEN to your current directory in Terminal:
rsync -av [email protected]:/path/to/directory . -
Finally, sometimes you might want to exclude certain files when copying a directory. To copy an entire directory, except for certain files, use the
--excludeoption For example, to copy the current directory, except for the hidden.gitdirectory that Git creates and except for the hidden.DS_Storefile that macOS creates, executersync -av --exclude .git --exclude .DS_Store . [email protected]:/path/to/directory