[英]Sort files on timestamp till milliseconds in Linux
我正在尝试通过SFTP从辅助服务器中提取文件,然后处理这些文件。 这些文件在辅助服务器上创建的时间不到1秒,因此所有文件都具有相同的创建时间戳。假设在辅助服务器上创建了4个文件(1.txt,2.txt,3.txt和4.txt)。服务器以相同的顺序。 但是,当我在服务器上运行ls -ltr命令时,输出如下:
同样,当我尝试使用ls --full-time -ltr命令基于毫秒前的时间对文件进行排序时,我得到以下输出:
上面的输出是错误的,因为文件1是在剩余文件之前创建的。 有人可以帮忙如何获得正确的排序列表。
由于时间戳甚至长达几毫秒都是相同的,因此我认为正确排序这些时间戳的唯一方法是使用每个文件的inode。 我认为该解决方案应该能够在您的情况下工作。
这是我的示例交互,我按此顺序同时创建了文件1、3、4、2。 使用ls --full-time -lt无效。 但是使用ls --full-time -i | sort -u ls --full-time -i | sort -u按创建顺序列出这些文件。
ls --full-time -lt
ls --full-time -i | sort -u
[英]Recursively filter & sort files by timestamp
[英]sort logfile by timestamp on linux command line
[英]sort across multiple files in linux
[英]Linux grep and sort log files
[英]How to sort files in linux by number?
[英]How to reverse and sort files in Linux?
[英]Using linux sort on multiple files
[英]Linux C process wait till copy of files completed (shell command)
[英]Delete the files in current folder in the Linux based on the timestamp
[英]Batch renaming of files with a modified timestamp on Linux
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.