Renaming files with inode number [UNIX]

余生长醉 提交于 2019-12-11 07:04:03

问题


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.

The description is:

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.

Any ideas?


回答1:


It is easy if parallel is available :

ls f* | parallel 'mv {} newDir/{}_`stat -c%i {}`'


来源:https://stackoverflow.com/questions/16074707/renaming-files-with-inode-number-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!