You can drag and drop the file or the directory (source or target) into Terminal rather than type the full name and path. Add -p to preserve attributes like access time, modification date.Add -n to avoid over-writing existing files.Add “-r” to copy a directory and its sub-directories (recursive). ![]() This copies the “Documents” folder to “Documents backup”. The quotes are needed because of the space in the directory name. This copies all jpg files from the current (working) directory to the Documents/photos directory $ cp -r Documents "Documents backup" This makes a copy of the file foo and names it foo.2 $ cp *.jpg ~/Documents/photos Syntax : cp Source_file Target_fileĬp Source_file(s) Target_Folder Use cp (copy) to copy files or directories. Finally she used cd with no argument to jump back to the home directory. She cd’ed to the directory motorcycles and saw that each bike had its own directory. Kathy began in her home directory, then went to her photos subdirectory she found what was in this directory (two sub-directories) using ls. $ /Users/kathy/Documents/photos/motorcycles Use cd (change directory) to change directories use pwd to determine your current (working) directory. ![]()
0 Comments
Leave a Reply. |