|
add path to flenames
Hello,
I have thousands files in thousands subfolders. All subfolders are named differently, but all files named like:
AAA_000_001.tif
AAA_000_002.tif
and so on (AAA_000_999.tif)
I have to replace "AAA_000" with the path of the file.
For example if I have a file AAA_000_001.tif in Foled/sub1/sub2, I have to rename AAA_000_001.tif to Foled/sub1/sub2_001.tif (or Folder_sub1_sub2_001.tif)
I have searched several forums, and so far I have this script:
for a in `find ./ -name "AAA_000*"`
do
mv $a `echo "$a" | sed 's/AAA_000/BBB/g'`
printf $PWD $a
done
it can replace all AAA of all files in all subfolders with BBB, but I did not find a way to replace it with the path (
I will really appreciate your help
Thanks
|