Article 5PEJT Renaming the files using text file in the subdirectories

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.latest?d=yIl2AUoC8zA latest?i=zv4hwleR-jE:r6xZhOZyW6o:F7zBnMy latest?i=zv4hwleR-jE:r6xZhOZyW6o:V_sGLiP latest?d=qj6IDK7rITs latest?i=zv4hwleR-jE:r6xZhOZyW6o:gIN9vFwzv4hwleR-jE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments