小智 86
如果你有FileZilla,你可以使用这个技巧:
Add files to queue
这将扫描所有文件夹和文件,并将它们添加到队列中.然后查看队列窗格及其下方(在状态栏上),您应该看到一条指示队列大小的消息.
tan*_*ius 15
您可以将du
命令lftp
用于此目的,如下所示:
echo "du -hs ." | lftp example.com 2>&1
Run Code Online (Sandbox Code Playgroud)
这将打印当前目录的磁盘大小incl.所有子目录,以人类可读的格式(-h
)和省略子目录的输出行(-s
).stderr输出被重新路由到stdout,2>&1
以便它包含在输出中.
但是,它lftp
是一个仅限Linux的软件,所以要从C#中使用它,你需要在Cygwin中使用它.
该lftp du
命令文件是从丢失它的手册页,但与该lftp的外壳内可用的help du
命令.作为参考,我在这里复制它的输出:
lftp :~> help du
Usage: du [options] <dirs>
Summarize disk usage.
-a, --all write counts for all files, not just directories
--block-size=SIZ use SIZ-byte blocks
-b, --bytes print size in bytes
-c, --total produce a grand total
-d, --max-depth=N print the total for a directory (or file, with --all)
only if it is N or fewer levels below the command
line argument; --max-depth=0 is the same as
--summarize
-F, --files print number of files instead of sizes
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si likewise, but use powers of 1000 not 1024
-k, --kilobytes like --block-size=1024
-m, --megabytes like --block-size=1048576
-S, --separate-dirs do not include size of subdirectories
-s, --summarize display only a total for each argument
--exclude=PAT exclude files that match PAT
Run Code Online (Sandbox Code Playgroud)