使用cp复制目录时如何制作进度条? [英] How can I make a progress bar while copying a directory with cp?

查看:296
本文介绍了使用cp复制目录时如何制作进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我可以在cp进行时比较源目录中的文件数与目标目录中的文件数,或者可以用文件夹大小来比较?我试图找到示例,但是所有bash进度条似乎都是为复制单个文件而编写的.我想复制一堆文件(或目录,如果不能的话).

I suppose I could compare the number of files in the source directory to the number of files in the target directory as cp progresses, or perhaps do it with folder size instead? I tried to find examples, but all bash progress bars seem to be written for copying single files. I want to copy a bunch of files (or a directory, if the former is not possible).

推荐答案

您也可以像这样使用rsync代替cp:

You can also use rsync instead of cp like this:

rsync -Pa source destination

这将为您提供进度条和预计的完成时间.非常方便.

Which will give you a progress bar and estimated time of completion. Very handy.

这篇关于使用cp复制目录时如何制作进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆