Skip to main content
added 400 characters in body
Source Link

I am trying to rename the files and directories using a text file separated by space.

The text filefiles.txt looks like this:

dir1-1 dir1_1
dir2-1 dir223_1

My command is as follows:

xargs -r -a files**files.txttxt** -L1 mv

The files look like this (in directory 1):

dir1-1.txt dir1-1.gzip dir1-1-something.text

The output for the files should look like this (in the dir1-1):

dir1_1.txt dir1_1.gzip dir1_1-something.text

The files in directory (dir2) looks like this:

dir2-1.py dir2-1.txt dir2-1.text

The output should look like this:

dir223_1.py dir223_1.txt dir223_1.text

This command can rename only folders from dir1-1 to dir1_1 and dir2-1to dir223_1so 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.txt dir1-1.gzip dir1-1.csv)

It will be somewhat similar like: Script for renaming files using text file containing alternate file names

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:

dir1-1 dir1_1
dir2-1 dir223_1

My command is as follows:

xargs -r -a files.txt -L1 mv

This command can rename only folders from dir1-1 to dir1_1 and dir2-1to dir223_1so 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.txt dir1-1.gzip dir1-1.csv)

It will be somewhat similar like: Script for renaming files using text file containing alternate file names

Looking forward for the assistance.

I am trying to rename the files and directories using a text file separated by space.

The files.txt looks like this:

dir1-1 dir1_1
dir2-1 dir223_1

My command is as follows:

xargs -r -a **files.txt** -L1 mv

The files look like this (in directory 1):

dir1-1.txt dir1-1.gzip dir1-1-something.text

The output for the files should look like this (in the dir1-1):

dir1_1.txt dir1_1.gzip dir1_1-something.text

The files in directory (dir2) looks like this:

dir2-1.py dir2-1.txt dir2-1.text

The output should look like this:

dir223_1.py dir223_1.txt dir223_1.text

This command can rename only folders from dir1-1 to dir1_1 and dir2-1to dir223_1so 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.txt dir1-1.gzip dir1-1.csv)

It will be somewhat similar like: Script for renaming files using text file containing alternate file names

Looking forward for the assistance.

Source Link

Renaming the files and folders using text files

I am trying to rename the files and directories using a text file separated by space.

The text file looks like this:

dir1-1 dir1_1
dir2-1 dir223_1

My command is as follows:

xargs -r -a files.txt -L1 mv

This command can rename only folders from dir1-1 to dir1_1 and dir2-1to dir223_1so 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.txt dir1-1.gzip dir1-1.csv)

It will be somewhat similar like: Script for renaming files using text file containing alternate file names

Looking forward for the assistance.