I was wondering is there another way of renaming a file aside from using mv in linux?
For example changing /home/usr/blah.txt to something like -home-usr-blah.txt
|
This goes to show that you need to think about how you ask the question. Everybody - including me - got your question wrong initially You could use qmv to bulk rename interactively using an editor. It will allow search/replace and also cyclic renames. Simple What mv really accomplishes at the driver level is close to this:
So, you can do that. This, however assumes the optimized scenario where source & target reside in the same filesystem. If not, you will have to use cp instead of ln. Be sure to make that a Update in response to (paranoid) comment:
|
|||||||||
|
|
also hardlinks can be used for renaming files
|
|||||
|
|
You can use "rename" feature in various file management tools like Midnight Commander to do this, or you could use the |
|||||
|
|
Well, there is But if you want to rename a full path into a single filename you will need to use other tools like |
|||
|
|
cpandrm, but what's the point? – Matt Ball May 28 '11 at 20:07lnassociates another path with an existing inode.unlinkdis-associates one of the associated paths from an inode.touch newfilecreates a new inode with associated pathnewfile. inodes are reference counted, i.e.: storage is reclaimed after the last referring path is unlinked. What else does it have to do with? Filesystems might implement this differently, but if they are POSIX compliant, the end result is exactly the same (google POSIX rename) – sehe May 30 '11 at 15:03