重命名具有 inode 编号的文件 [UNIX] [英] Renaming files with inode number [UNIX]

查看:56
本文介绍了重命名具有 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 {}`'

这篇关于重命名具有 inode 编号的文件 [UNIX]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆