[prev in list] [next in list] [prev in thread] [next in thread]
List: opensuse
Subject: Re: Can you help with rename files? (a bit offtopic, sorry)
From: "David C. Rankin" <drankinatty () suddenlinkmail ! com>
Date: 2023-12-24 0:16:26
Message-ID: 4c79f7f0-744f-4bcc-bbd9-ad423b89372f () suddenlinkmail ! com
[Download RAW message or body]
On 12/23/23 08:38, Daniel Bauer wrote:
> I have lots of files named like
> 07X55c_IMG_0155.png
> where 07X55c is a random text of varable lengths which I want to cut so that
> the file will be renamed to IMG_0155.png
>
> In my simple-mindedness I just opened mc, selected all the files and typed in
> the rename dialog
> replace *IMG*
> by IMG*
If they are all in one directory, just cd to that directory and do:
for fnmame in *IMG*.png; do mv "$fname" "${fname#*_}"; done
or if in multiple subdirectories feed a while loop with find:
while read -r fname; do mv "$fname" "${fname#*_}"; done < <(find the/path
-type f -name "*IMG*.png")
--
David C. Rankin, J.D.,P.E.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic