|
Copy multiple files - confusing error message from cp
Thought you might like me to share this one ...
Copying a whole series of files into a directory (Linux, Unix, OS X) using cp, you give a whole series of source files followed by the name of the target directory. Add the -r option is you want to specify subdirectories to be copied recursively in your input.
So this should work, eh?
grahamellis$ cp -r whc.css images grgen.php ~/back_20061229/htaccess
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
grahamellis$
What an odd result. Is the -r option wrong? No - that's not the problem. In my opinion, there's a bug in cp in that the usage line is incomplete, but that's not the real problem. The real problem was that I specified an existing file name as the target for my copy, and cp won't copy a whole series of files into one.
If I correct my command (by specifying a target directory name), it works perfectly:
grahamellis$ cp -r whc.css images grgen.php ~/back_20061229
grahamellis$
Footnote - if you want to preserve file ownerships as you copy them, use tar instead of cp. You need administrator access (i.e. be logged in as root) to do this. (written 2006-12-30 09:59:53)
Associated topics are indexed under A101 - Web Application Deployment - Linux -An Introduction For UsersA162 - Web Application Deployment - Backups and File System Management
Some other Articles
css - handling white space and preModernising from tables to cascading style sheetsSearch engine placement - long term strategy and successChristmas Season PicciesCopy multiple files - confusing error message from cpMoving files between Windows / DOS and Linux / UnixWell House Manor and Beechfield House, Hotels, MelkshamDates, times, clickable diarys in PHPPassing GET parameters through Apache mod_rewriteDate conversion - PHP
|
1891 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 at 50 posts per page
This is a page archived from The Horse's Mouth at
http://www.wellho.net/horse/ -
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).
|
|