管道目录到du

时间:2014-04-09 08:15:53

标签: file directory find pipe du

我尝试使用与此StackOverflow文章类似的内容: Why does "find . -name *.txt | xargs du -hc" give multiple totals?

但是,即使在此处和网络上浏览了几篇文章之后,也无法破解它。

我所要做的就是密切关注我们的网络驱动器每天/每周/每月/每年使用的存储空间以及使用它的位置。我想要做的就是使用find来发现比x更新但比n更旧的东西,并使用-h开关将结果(许多目录和文件路径)传递给du,以添加文件/目录大小,最终输出到文件。

这是我到目前为止所写的内容:

export newerthan="1 Apr 2014 00:00:00" export olderthan="30 Apr 2014 23:00:00" find /Volumes/Competition -newermt "$newerthan" ! -newermt "$olderthan" | du -h > files.dat

如果我删除du部分(它正确地将匹配条件的列表打印到files.dat中),这可以正常工作,但是在那里使用du部分,它将只打印整个当前工作目录的文件/目录大小。

有人能够提供帮助吗?

编辑:值得一提的是我在OS X上这样做。

干杯, 布罗迪

0 个答案:

没有答案