1

Question: on a Linux File System, I am trying to locate large numbers of files with similar name patterns; for cleanup. The issue here is that I have no idea what such patterns would look like; this is what the script should show us.

Example: e.g., a typical outcome of the script could be: "we have accumulated around 10k files looking like 'create_some_kind_of_log_*.log' and 19k files matching '/some_kind_of_dir/daily_blah_file*.dat'"

Before we would not be 'aware' that these files are being accumulated in such large numbers; they were under the radar because of their small size.

Any input would be appreciated!

Cheers

Edit Maybe a workaround would be to just look for directories where there are a large number of files; this could also help in the analysis. Thanks!!

4

1 回答 1

1

我已经修改了答案以防万一。这将生成一个目录列表,按每个文件的数量排列。

find . -type d | xargs ls -dl | awk '{print $2, $9}' > f.tmp
sort -nr f.tmp
于 2013-03-20T09:45:02.950 回答