Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一组具有以下命名约定的文件:
datetime_restofname.txt
一个例子是:
200906290700_somewordorphrase.txt
如何批量更改文件的 mtime 以匹配文件名中的日期和时间?
$ for f in *.txt; do touch -t `echo $f | cut -f1 -d _` "$f"; done
这会将文件 modtime 设置为下划线之前的日期字符串。