Re: Removing a space from file name
[email protected] (Mike Hübschen via beginners) Mon, 17 Feb 2025 19:52:12 +0100
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
Hello, Try something like this: rename 's/(.*?)\s(\d+).jpg$/$1$2.jpg/' *.jpg But make a backup first. Best regards, Mike On 2/17/25 18:38, hput wrote: > I have several hundred *.jpg files with this pattern > > Actual example: > > 'AtlantaVisitAndGrandmaHands 056.jpg' > > The numbers vary, of course, but the alpha part and number of digits > after the space is the same in all *.jpg files > > I have hundreds of these all in one directory. Not something you'd > want to do one at a time. > > I tried to figure a way using the perl `rename' tool found in many linux > distro's repos > > But couldnt figure out the necessary syntax from Larry Wall's examples > in the rename man page. Using the "s///" operators , it's probably > there some how but my pea brain isn't seeimg it. > > bash has just used the apostrophes to make the names usable but > I would much rather remove the space. > >