简体   繁体   English

Rsync在传输之前计算文件计数?

[英]Rsync calculate file count before transfer?

When transferring lots of small files in many folders with rsync, it tends to stay around ir-chk=1000/xxxxx , where xxxxx keeps counting up as it discovers new files, and the amount to check stays around 1000 until its on its last few folders. 当使用rsync在许多文件夹中传输许多小文件时,它倾向于停留在ir-chk=1000/xxxxx ,其中xxxxx在发现新文件时一直在计数,并且检查数量一直保持在1000左右,直到最后几张为止文件夹。

How can I have it check for the entire file count before copying? 如何在复制之前检查整个文件计数?

The command I was using to copy was: 我用来复制的命令是:

rsync -av --progress source dest
rsync -av --progress --dry-run --stats source dest
  • Option --dry-run doesn't transfer any files but will show how many bytes will be transferred. 选项--dry-run不传输任何文件,但会显示要传输多少字节。
  • Option --stats shows a summary. 选项--stats显示摘要。

a sample output: 样本输出:

...
tests/
tests/__init__.py
tests/test_config.py

Number of files: 5,033 (reg: 2,798, dir: 2,086, link: 149)
Number of created files: 5,032 (reg: 2,798, dir: 2,085, link: 149)
Number of deleted files: 0
Number of regular files transferred: 2,798
Total file size: 26,035,530 bytes
Total transferred file size: 26,032,322 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.004 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 158,821
Total bytes received: 17,284

sent 158,821 bytes  received 17,284 bytes  117,403.33 bytes/sec
total size is 26,035,530  speedup is 147.84 (DRY RUN)

Get the number of files will be transferred 获取将要传输的文件数

rsync -av --progress --dry-run --stats source dest | 
  fgrep 'Number of files' | 
  cut -d' ' -f4 | 
  tr -d ,

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

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