Sunday, August 31, 2008

To rename a file using inode value

When a file/directory is saved with special character other than underscore('_') then it is difficult to remove/rename it. Inorder to remove that file/directory, first rename to a valid filename.

Procedure:
Goto directory where the file/directory is present.
Run this command:
ls -iltr
copy the inode value associated with that file/directory which you want to rename/remove and put that number in the following command in place of XXXXX and replace newname with your desired filename.

find . -inum XXXXX -exec mv {} newname \;

No comments:

Post a Comment