|
@@ -1,27 +1,35 @@
|
|
|
# cp
|
|
|
|
|
|
-> Copy files.
|
|
|
+> Copy files and folders.
|
|
|
|
|
|
-- Copy files in arbitrary locations:
|
|
|
+- Copy a file to another location:
|
|
|
|
|
|
-`cp {{/path/to/original}} {{/path/to/copy}}`
|
|
|
+`cp {{/path/to/file.ext}} {{/path/to/copy.ext}}`
|
|
|
|
|
|
-- Copy a file to a parent directory:
|
|
|
+- Copy a file into another folder, keeping the filename:
|
|
|
|
|
|
-`cp {{/path/to/original}} ../{{path/to/copy}}`
|
|
|
+`cp {{/path/to/file.ext}} {{path/to/target/parent/folder}}`
|
|
|
|
|
|
-- Copy directories recursive using the option -r:
|
|
|
+- Copy a folder recursively to another location:
|
|
|
|
|
|
-`cp -r {{/path/to/original}} {{/path/to/copy}}`
|
|
|
+`cp {{/path/to/folder}} {{/path/to/copy}}`
|
|
|
|
|
|
-- Show files as they are copied:
|
|
|
+- Copy a folder recursively into another folder, keeping the folder name:
|
|
|
|
|
|
-`cp -vr {{/path/to/original}} {{/path/to/copy}}`
|
|
|
+`cp -r {{/path/to/folder}} {{/path/to/target/parent/folder}}`
|
|
|
|
|
|
-- Make a copy of a file, adding an extension:
|
|
|
+- Copy a folder recursively, in verbose mode (shows files as they are copied):
|
|
|
+
|
|
|
+`cp -vr {{/path/to/folder}} {{/path/to/copy}}`
|
|
|
+
|
|
|
+- Copy the contents of a folder into another folder:
|
|
|
+
|
|
|
+`cp -r {{/path/to/source/folder/*}} {{/path/to/target/folder}}`
|
|
|
+
|
|
|
+- Copy of a file adding an extension:
|
|
|
|
|
|
`cp {{file.html}}{,.backup}`
|
|
|
|
|
|
-- Make a copy of a file, changing the extension:
|
|
|
+- Copy a file, changing the extension:
|
|
|
|
|
|
`cp {{file.}}{html,backup}`
|