简体   繁体   English

是否有最快的选项将cp文件从dir1传输到dir2?

[英]is there a fastest option to cp files from dir1 to dir2?

i used cp to copy lots of small files (b/n 1M and 10M size; around 6G total) in Linux box. 我用cp在Linux机器中复制了许多小文件(b / n 1M和10M大小;总共6G左右)。 Didn't time it but since i am going to do cp again and again, can time it and be more specific later; 时间 ,但是因为我要一次又一次地执行cp ,所以可以时间了,以后再具体点; but since the cp is not the major task, can't tolerate the time it's taking if there is a better option/choice/way. 但由于cp并不是主要任务,因此如果有更好的选择/选择/方法,则无法忍受花费的时间。 So, if there is a better way/option/method to do cp -ing (faster) files from one dir to another, be glad glad to try it out. 因此,如果有更好的方法/选项/方法可以将cp文件(从一个目录中快速复制到另一个目录中),请尝试一下。

Thanks, 谢谢,

告诉tar / untar或rsync任何一个,当它们不进行校验和检查时,都会更快,因为它们会批量读取文件,而不是一一对应地处理它们。

Have you tried: 你有没有尝试过:

time (cd /usr/local/src/ && tar pcf - cvs.gnome.org) | buffer -m 8m -p 75 | (cd /mnt/tmp/src/ && tar pxf -) 

(Credits: https://lists.debian.org/debian-user/2001/06/msg00288.html ) (积分: https : //lists.debian.org/debian-user/2001/06/msg00288.html

You could try cpio , as that has a copy directory to directory mode. 您可以尝试cpio ,因为该目录具有复制到目录模式的目录。

use perl for fastest copy: 使用perl进行最快的复制:

use File::Copy::syscopy;  # preserves OS specific file attributes
copy($foo,$bar) or die "cannot copy $foo to $bar: $!";  # always check for errors!

Try this just backup today's files: 试试这个只是备份今天的文件:

find /home/me/files -ctime 0 -print -exec cp {} /mnt/backup/{} \;

from: http://commandperls.com/find-all-today%E2%80%99s-files-and-copy-them-to-another-directory/ 来自: http : //commandperls.com/find-all-today%E2%80%99s-files-and-copy-them-to-another-directory/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM