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 »

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post 7 months ago by Pr. Sunflower‭.

76 / 255
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-*"
  • ```

Suggested 7 months ago by matthewsnyder‭