Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A Rename multiple files which have a variable suffix

I compressed some JPEGs with curtail it messed up the filenames. It was supposed to only add -min at the end but ended up adding a random string after the extension 😠: prs@PC:/DOWNLOADS/Pictures$ ...

3 answers  ·  posted 1y ago by Pr. Sunflower‭  ·  edited 1y ago by matthewsnyder‭

Question renaming
#2: Post edited by user avatar matthewsnyder‭ · 2023-10-20T18:32:10Z (about 1 year ago)
Cleaned up parts that would not be useful to future readers of this question
Rename multiple files which have a variable suffix
  • Hello fellow community 👋
  • **_Curtail_** did a good job at compressing my JPEG pictures but a **very bad job** at naming them... 😑
  • It was supposed to only add `-min` at the end but ended up adding a **random string** after the extension 😠 :
  • ```
  • prs@PC:/DOWNLOADS/Pictures$ find . -type f
  • ./IMG_20230917_093726_2-min.jpg-U2XlUA <<< To rename "[...]_2-min.jpg"
  • ./IMG_20230917_093726_2.jpg - Don't do anything
  • ./IMG_20230917_093738_3-min.jpg-H39QsD <<< To rename "[...]_3-min.jpg"
  • ./IMG_20230917_093738_3.jpg - Don't do anything
  • ./IMG_20230917_094057_1-min.jpg-AbxJMt <<< To rename "[...]_1-min.jpg"
  • ./IMG_20230917_094057_1.jpg - Don't do anything
  • ```
  • <br>
  • **My question is:** How can I remove the random string for each `-min` file?
  • I already have a **find** command that gets the `-min` files while excluding the pictures I don't want to touch:
  • ```
  • find . -name "*-min.jpg-*"
  • ```
  • <br>
  • Your help would be greatly appreciated 🙂
  • Cheers! ✌️
  • I compressed some JPEGs with `curtail` it messed up the filenames. It was supposed to only add `-min` at the end but ended up adding a **random string** after the extension 😠:
  • ```
  • prs@PC:/DOWNLOADS/Pictures$ find . -type f
  • ./IMG_20230917_093726_2-min.jpg-U2XlUA <<< To rename "[...]_2-min.jpg"
  • ./IMG_20230917_093726_2.jpg - Don't do anything
  • ./IMG_20230917_093738_3-min.jpg-H39QsD <<< To rename "[...]_3-min.jpg"
  • ./IMG_20230917_093738_3.jpg - Don't do anything
  • ./IMG_20230917_094057_1-min.jpg-AbxJMt <<< To rename "[...]_1-min.jpg"
  • ./IMG_20230917_094057_1.jpg - Don't do anything
  • ```
  • How can I remove the random string for each `-min` file?
  • I already have a `find` command that gets the `-min` files while excluding the pictures I don't want to touch:
  • ```
  • find . -name "*-min.jpg-*"
  • ```
#1: Initial revision by user avatar Pr. Sunflower‭ · 2023-10-13T20:00:27Z (about 1 year ago)
Rename multiple files which have a variable suffix
Hello fellow community 👋

**_Curtail_** did a good job at compressing my JPEG pictures but a **very bad job** at naming them... 😑

It was supposed to only add `-min` at the end but ended up adding a **random string** after the extension 😠 :

```
prs@PC:/DOWNLOADS/Pictures$ find . -type f
./IMG_20230917_093726_2-min.jpg-U2XlUA   <<< To rename "[...]_2-min.jpg"
./IMG_20230917_093726_2.jpg              - Don't do anything
./IMG_20230917_093738_3-min.jpg-H39QsD   <<< To rename "[...]_3-min.jpg"
./IMG_20230917_093738_3.jpg              - Don't do anything
./IMG_20230917_094057_1-min.jpg-AbxJMt   <<< To rename "[...]_1-min.jpg"
./IMG_20230917_094057_1.jpg              - Don't do anything
```

<br>

**My question is:** How can I remove the random string for each `-min` file?

I already have a **find** command that gets the `-min` files while excluding the pictures I don't want to touch:

```
find . -name "*-min.jpg-*"
```

<br>

Your help would be greatly appreciated 🙂

Cheers! ✌️