Removing certain numbers from batch of filenames
0
votes
2
answers
249
views
I have a batch of files that contain the numbers 21 to 29 in the middle of the file name. As I do not want to remove that number for hundreds of files by hand I tried using Terminal:
for f in *;
do for x in {21..29};
rename=echo "$f" | sed 's/\$x//'
mv "$f" "$rename"; done;
However, nothing happens. If I replace the "$x" with the letter "a" just for fun on a test folder with a few of the files, the first letter "a" is actually removed, but for the numbers it does not work. What am I doing wrong?
I'd appreciate any help very much!
Thank you!
Asked by Michael
(1 rep)
May 26, 2023, 03:36 PM
Last activity: May 26, 2023, 06:16 PM
Last activity: May 26, 2023, 06:16 PM