重命名具有 inode 编号的文件 [UNIX]

编程入门 行业动态 更新时间:2024-10-23 18:30:19
本文介绍了重命名具有 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]

本文发布于:2023-11-04 05:31:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557080.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重命名   编号   文件   UNIX   inode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!