Categories: Apple, Command-Line

Chris Manning

Share

I use this one a lot, use this on the command line to copy a file or folder. The -r is recursive so it will include the all files in a directory/folder. The -v is verbose so you can watch the command line fill with the file paths as they are being copied.

cp -v -r file/folder/source file/folder/destination

You can also Move a file using “mv” in place of the “cp” like this:

mv file/folder/source file/folder/destination

If you use the same source and destination the file will be renamed, in the above case, “source” will be renamed to “destination”.

In addition, if your backing up a file you can append the following to files you “mv” or “cp”, so you know the date of your action: i.e. file/folder/source file/folder/destination`date +%Y%m%d`

`date +%Y%m%d`

Also, if you were not aware you can create a Directory or folder with:

mkdir DirectoryName

Leave A Comment

Related Posts