Renaming the files using text file in the subdirectories
by Asoo from LinuxQuestions.org on (#5PEJT)
Hi,
I am trying to rename the files and directories using a text file separated by space.
The text file looks like this:
Code:dir1-1 dir1_1
dir2-1 dir223_1My command is as follows:
Code:xargs -r -a files.txt -L1 mvThis command can rename only folders from dir1-1 to dir1_1 and dir2-1 to dir223_1 so on but it doesn't rename the files in the subdirectories. The files in the corresponding directories also have these prefix of these directories. (like dir1-1-something.txt, dir1-1.gzip etc.) In short, renaming the content of each file with the new name.
Looking forward for the assistance.
I am trying to rename the files and directories using a text file separated by space.
The text file looks like this:
Code:dir1-1 dir1_1
dir2-1 dir223_1My command is as follows:
Code:xargs -r -a files.txt -L1 mvThis command can rename only folders from dir1-1 to dir1_1 and dir2-1 to dir223_1 so on but it doesn't rename the files in the subdirectories. The files in the corresponding directories also have these prefix of these directories. (like dir1-1-something.txt, dir1-1.gzip etc.) In short, renaming the content of each file with the new name.
Looking forward for the assistance.