10月 8th, 2008

linux下拷贝整个目录的命令

Category: linux, Author: admin, Popularity: 14%

如果想重新整理文件组织结构,可使用下面的方法移动文件及文件链接:

标准方法:
# cp -a /source/directory /dest/directory # 要求 GNU cp
# (cd /source/directory && tar cf – . ) | \
(cd /dest/directory && tar xvfp – )
如果包含硬链接,则需要更严谨的方法:
# cd /path/to/old/directory
# find . -depth -print0 | afio -p -xv -0a /mount/point/of/new/directory
如果是远程操作:
# (cd /source/directory && tar cf – . ) | \
ssh user@host.dom (cd /dest/directory && tar xvfp – )
如果没有链接文件:
# scp -pr user1@host1.dom:/source/directory \
user2@host2.dom:/dest/directory

相关日志

Tags:.
评论数量() | Add Comments
本文网址:http://www.9usb.net/200810/linux-cp.html

No Comments so far

» You can leave a response

1 Trackbacks/Pingbacks

leave a reply