Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:37:33+00:00 2026-06-12T04:37:33+00:00

I have a folder with images and I need to copy them elsewhere removing

  • 0

I have a folder with images and I need to copy them elsewhere removing special chars in the progress.
Lets say I have this

Folder1/ImageÑ%1.jpg
Folder1/ImageÑ%1-70x70.jpg
Folder1/ImageÑ%2.jpg
Folder1/ImageÑ%2-70x70.jpg
Folder1/ImageÑ%3.jpg
Folder1/ImageÑ%3-100x100.jpg
Folder1/ImageÑ%4.jpg
Folder1/ImageÑ%4-100x100.jpg

And I want to copy just the files that doesn’t have “-70×70” or “-100×100” in the name to Folder2 and be like this (without any special char):

Folder2/Image1.jpg
Folder2/Image2.jpg
Folder2/Image3.jpg
Folder2/Image4.jpg

I’ve managed to copy the files, but I have no clue how to rename the files (and remove the special chars) in the same step. I think it’s using SED but I can’t figure out how.

find Folder1 -type f -regextype posix-extended \( ! -regex '.+\-[0-9]{2,4}x[0-9]{2,4}\.jpg' \) -print0 |  xargs -0 cp -p --target-directory=Folder2

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:37:34+00:00Added an answer on June 12, 2026 at 4:37 am

    This maybe works for you:

    #!/bin/bash
    DIR=/your/Folder1
    DEST=/your/Folder2
    
    for f in `ls -1 $DIR | grep .jpg | egrep -v ".+\-[0-9]{2,4}x[0-9]{2,4}\.jpg"`
    do
            f=$(basename $f)
            F=$(echo "$f" | sed "s/[^A-Z|a-z|0-9|\.]//g;")
            cp -p "$DIR/$f" "$DEST/$F"
    done
    

    You can use MV instead of CP if you needit.

    EDITED

    This will get only the files you have to copy:

    ls -1 $DIR/*.jpg | egrep -v ".+\-[0-9]{2,4}x[0-9]{2,4}\.jpg
    

    basename command get only the file name in order to replace weir characters and prepare to move
    sed it’s replacing all character if the aren’t letters and numbers (and a dot for file extension)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder with approx 10000 images, and I need to copy about
I have about 1500 images within a folder named 3410001ne => 3809962sw. I need
I have a folder C:\Images which has a some images. This folder is not
I currently have several WPF projects that need to access a folder of images.
I have a folder full of 2000 images, all unique and named like this:
I need to copy some images I embedded in the assets folder of my
I'm having trouble with my Apache Web Server. I have a folder (htdocs\images) where
I have a folder with a few background images (one.jpg, two.jpg, three.jpg) , and
I have a folder that contains more than 200K images. Some images will follow
I have a folder in my WPF app Images that has several .png files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.