重命名具有 inode 编号的文件 [UNIX]
问题描述:
在将文件移动到目录之前,我只是尝试通过附加下划线和所述文件的 inode 编号来重命名文件.
I'm simply trying to rename a file by attaching an underscore and the inode number of said file before I move it to a directory.
描述是:
为避免回收站中的名称冲突,请将文件名更改为原始名称后跟下划线,后跟索引节点文件.例如,如果一个名为f1"且 inode 为 1234 的文件被删除后,该文件将在回收站中命名为 f1_1234.
To avoid name conflicts in the recycle bin, change the file name to the original name followed by an underscore, followed by the inode for the file. For example, if a file named "f1" with inode 1234 were removed, the file would be named f1_1234 in the recycle bin.
有什么想法吗?
答
如果 parallel 可用,这很容易:
It is easy if parallel is available :
ls f* | parallel 'mv {} newDir/{}_`stat -c%i {}`'