我想保持这个命令的输出不变,但我不想要路径,只想要文件名。
前任。 04-06-2020 23:09:02 filename
不是 04-06-2020 23:09:02 /root/dir1/dir2/filename
这是命令:
find path -type f -printf '%TY-%Tm-%TT %p\n' | sort -r
最佳答案
更改%p
至%f
.
find path -type f -printf '%TY-%Tm-%TT %f\n' | sort -r
%f
File's name with any leading directories removed (only the last element).
%p
File's name.
Source
关于linux - 有什么办法可以保留文件名(+日期小时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62204232/