Basic linux question - copying
Hi, I have a directory under the /html root of my web server, and I'd like to simultaneously copy recursively this directory and rename it to the same /html root. I understand that I can first create a new directory, test1, and then cd into the directory I want to copy recursively and do cp -R * ../test1 but is there an easier way? Someting like copy -R source-folder-name new-folder-name ? Thanks in advance,
On Wed, Apr 24, 2002 at 11:29:45AM +0200, php@nickselby.com wrote:
Hi, I have a directory under the /html root of my web server, and I'd like to simultaneously copy recursively this directory and rename it to the same /html root.
I understand that I can first create a new directory, test1, and then cd into the directory I want to copy recursively and do
cp -R * ../test1
but is there an easier way? Someting like
copy -R source-folder-name new-folder-name
cp -R can copy directories like this. However, you might like to use cp -a instead, as it preserves symbolic links and permissions. -- David Smith Work Email: Dave.Smith@st.com STMicroelectronics Home Email: David.Smith@ds-electronics.co.uk Bristol, England
At 11:00 AM 4/24/2002 +0100, you wrote:
On Wed, Apr 24, 2002 at 11:29:45AM +0200, php@nickselby.com wrote:
Hi, I have a directory under the /html root of my web server, and I'd like to simultaneously copy recursively this directory and rename it to the same /html root.
I understand that I can first create a new directory, test1, and then cd into the directory I want to copy recursively and do
cp -R * ../test1
but is there an easier way? Someting like
copy -R source-folder-name new-folder-name
cp -R can copy directories like this. However, you might like to use cp -a instead, as it preserves symbolic links and permissions.
Thanks, Dave, So cp -a source-folder-name new-folder-name will do it? TIA, Nick
On Wed, Apr 24, 2002 at 12:31:52PM +0200, php@nickselby.com wrote:
Thanks, Dave,
So
cp -a source-folder-name new-folder-name
will do it?
Yes, assuming that I've understood your problem correctly. AIUI, you have a directory called ..../some_directory, which contains a subdirectory 'dir1'. You want to copy dir1, and all its contents to a new directory, 'dir2', so that some_directory now contains both dir1 and dir2. If this is correct, then cd ..../some_directory cp -a dir1 dir2 should work (given appropriate permissions). -- David Smith Work Email: Dave.Smith@st.com STMicroelectronics Home Email: David.Smith@ds-electronics.co.uk Bristol, England
Yes, assuming that I've understood your problem correctly.
AIUI, you have a directory called ..../some_directory, which contains a subdirectory 'dir1'. You want to copy dir1, and all its contents to a new directory, 'dir2', so that some_directory now contains both dir1 and dir2.
That's it in a nutshell.
If this is correct, then cd ..../some_directory cp -a dir1 dir2
should work (given appropriate permissions).
Excellent! Thanks! nick
participants (2)
-
Dave Smith
-
Nick Selby