>
https://man7.org/linux/man-pages/man1/ls.1.html-f list all entries in directory order
-i print the index number of each file (但跟楼主的 case 似乎没很大的关系)
>
https://unix.stackexchange.com/a/13456 user732 answered May 19, 2011 at 16:48
It depends on the filesystem. For some filesystems (ext3 among them), a directory is actually a file with a well-known format, and the 'd' bit set in its permissions or mode. In that case, the history of what length filenames have gotten created and deleted can matter. The kernel will fill in the first entry in the directory file that has enough room to hold the new file's name. See
http://e2fsprogs.sourceforge.net/ext2intro.html for more detail, the section titled "Physical Description".
(这里略去了一部分原文,大意是另外还有一些文件系统,其实是 ls 按字典序排的)
机译:这取决于文件系统。对于某些文件系统(其中包括 ext3 ),目录实际上是具有众所周知格式的文件,并且在其权限或模式中设置了“d”位。在这种情况下,创建和删除文件名长度的历史记录可能很重要。内核将填充目录文件中的第一个条目,该条目有足够的空间来保存新文件的名称。有关更多详细信息,请参阅
http://e2fsprogs.sourceforge.net/ext2intro.html ,标题为“物理描述”的部分。
似乎只要了解使用的文件系统及 ls 的内部实现就可以找到反向操纵 ls -f 的方法
另外需要提醒⚠️ 根据
https://stackoverflow.com/questions/5474765/order-of-loading-jar-files-from-lib-directory部分人提到 Tomcat 6 到 8 之间的行为有所不同,需要参照对应的文档。
拓展阅读:
https://stackoverflow.com/questions/67997151/spring-boot-inner-jar-files-loading-order-embedded-tomcat---
总结:可以把文件剪去一个新目录,或者按照期望的顺序,mv 到临时文件名再 mv 回来试试看
最后:亲娘嘞,还有这样的翻车方式?真是……Java EE !佩服佩服🙏 /手动狗头