From da10202a3dbdafe6ae9e3b6f0f03f355b208c41d Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Thu, 21 Jul 2016 13:31:39 +0100 Subject: [PATCH] cp.md: major overhaul - change "directory" to "folder" (more beginner-friendly) - use an extension to distinguish file paths from folder paths - reword some of the descriptions for clarity - include examples to clarify when the target argument defines the actual copy, and when it defines the folder where to put the copy - add an example to copy contents of a folder into another (existing) folder --- pages/common/cp.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pages/common/cp.md b/pages/common/cp.md index a05eea122..7b5298862 100644 --- a/pages/common/cp.md +++ b/pages/common/cp.md @@ -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}`