Entering edit mode
2.2 years ago
arshad1292
▴
110
Hello,
I have 500 folders and each folder contains about 5 files. I want to rename those files and include folder name with it.
For example:
My folders (sample1_1, sample2_2, sample3_3) look like this:
sample1_1: bin.1.permissive.fa bin2.orig.fa
sample2_2: bin.1.permissive.fa bin2.orig.fa
sample3_3: bin.1.permissive.fa bin2.orig.fa
Now, I want to rename in a way that files look like this:
sample1_1: sample1_bin.1.fa sample1_bin2.fa
In other words, I the following 2 things to be changed:
- Include folder name in the file but after removing last part of it.
- Remove middle part of the file i.e. permissive, orig etc.
Any linux expert here please help me in writing the script.
Many thanks in advance!
brename: safely batch renaming files/directories via regular expression
Can not install this... was able to download the tar file but can not run tar -zxvf *.tar.gz as it gives following error: