在给定年份的文件夹中以文件名查找所有pdf

时间:2019-01-27 09:24:37

标签: regex macos pdf grep

我有一个文件夹,其中有成千上万个pdf文件,它们根据public bool AddPadding(string filePath) { // Read from file using (MagickImage image = new MagickImage(filePath)) { int imageSize = Math.Max(image.Width, image.Height); // Add padding image.Extent(imageSize, imageSize, Gravity.Center, MagickColors.Purple); // Save the result image.Write(filePath); } } 20100820.pdf等日期命名。

在命令行中,我在其他项目中使用了以下命令来搜索文件夹中的所有pdf并将其附加命令,例如20000124.pdf。现在,例如,我希望它仅搜索 2010年以来给定文件夹中的那些pdf 。我该如何实现?

2 个答案:

答案 0 :(得分:0)

哇,最后太简单了。

这可以解决问题:

ls | grep -E "\.pdf$" | grep -E "2010"

答案 1 :(得分:0)

ll = list(filter(lambda x:x.expectation == max([obj.expectation for obj in my_list]), my_list))

此命令获取所有pdf文件并分割文件名,然后将文件名中的数字与20100000进行比较。如果大于,则打印文件名。