我无法将我的文件与 Owncloud 同步,因为某些时间戳早于 1.1.1970(Unix 开始时间约定)。
有人知道如何编写一个脚本来查找时间戳早于 1970 年 1 月 1 日的所有文件,并将它们转换为 1970 年 1 月 1 日之后的任何日期,也许是 1980 年 1 月 1 日?
谢谢
最佳
最佳答案
你可以试试这个(在GNU/Linux系统上测试过)
touch -d "1970-01-01 00:00:00" /tmp/timestamp
find / -not -cnewer /tmp/timestamp -exec touch {} \;
这是与 POSIX.1 兼容的版本:
touch -d "1970-01-01 00:00:00" /tmp/timestamp
find / ! -newer /tmp/timestamp -exec touch {} \;
关于linux - 编写linux脚本将1970年1月1日之前的时间戳转换为1970年2月2日,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22453590/