Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Debian GNU/Linux Reference Guide
Prev Home Next

8.3.1 Basic commands for copying a whole subdirectory

If you need to rearrange file structure, move content including file links by:

     Standard method:
     # cp -a /source/directory /dest/directory # requires GNU cp
     # (cd /source/directory && tar cf - . ) | \
             (cd /dest/directory && tar xvfp - )
     If a hard link is involved, a pedantic method is needed:
     # cd /path/to/old/directory
     # find . -depth -print0 | afio -p -xv -0a /mount/point/of/new/directory
     If remote:
     # (cd /source/directory && tar cf - . ) | \
             ssh [email protected] (cd /dest/directory && tar xvfp - )
     If there are no linked files:
     # scp -pr [email protected]:/source/directory \
               [email protected]:/dest/directory

Here, scp <==> rcp and ssh <==> rsh.

The following comparative information on copying a whole subdirectory was presented by Manoj Srivastava [email protected] to [email protected]

Debian GNU/Linux Reference Guide
Prev Home Next

  Published under the terms of the GNU General Public License Design by Interspire