Posted 24.09.2005 | Updated 23.05.2006 | Contributed by Andy Mallett
By default if you try to copy a directory using the cp command, BSD will error out with the following message:
cp: dirname is a directory (not copied).
Often the directory to be copied contains files too and cp has switches aplenty for all situations. I like to use what I call priv mode which is a good way to remember the required switches..
cp -priv usr/local/src/phpBB2 /usr/local/apache/htdocs
Where
p Preserve file attributes like date, time, etc.
r Recursive. Will also copy subdirectories.
i Interactive. Will prompt you if overwriting files.
v Verbose. Will show each file as it is copied.
|