【发布时间】:2018-05-15 07:29:36
【问题描述】:
文件按类别列出。
在YYYYMMDDHHMM 格式的文件名中处理。
如何删除除此文件名的最新文件之外的最旧文件?
"10MX232 .201801070702.txt" >>old file
"10MX232 .201801080703.txt" >>old file
"10MX232 .201801161651.txt" >>old file
"10MX232 .201801181531.txt" >>old file
"10MX232 .201805120846.txt" >>----new file
"1465LY1 .201804051311.txt" >>old file
"1465LY1 .201805101441.txt" >>old file
"1465LY1 .201805110912.txt" >>old file
"1465LY1 .201805111419.txt" >>----new file
"17NX232 .201801250054.txt" >>old file
"17NX232 .201801260055.txt" >>old file
"17NX232 .201801270055.txt" >>old file
"17NX232 .201801280056.txt" >>old file
"17NX232 .201801290057.txt" >>old file
"17NX232 .201801300058.txt" >>----new file
我想要这个结果
ls
10MX232 .201805120846.txt
1465LY1 .201805111419.txt
17NX232 .201801300058.txt
【问题讨论】:
-
欢迎来到 Stack Overflow。请展示您解决此问题的最新非工作尝试。通常,查看代码的修复比阅读其他人的解决方案更有指导意义。见stackoverflow.com/help/how-to-ask