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 8190961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:48:01+00:00 2026-06-07T03:48:01+00:00

I was testing/trying out this Perl one-liner , and I’m trying to figure out

  • 0

I was testing/trying out this Perl one-liner, and I’m trying to figure out what happened to the files. I don’t see the files anymore.
Did I delete them or what went wrong?

Example of file names listed (original):

IMG_0178.JPG
IMG_0182.JPG
IMG_0183.JPG
IMG_0184.JPG
IMG_0186.JPG

I wanted to simply change the file extension to lowercase (.jpg):

perl -e'while(<*.JPG>) { s/JPG$/jpg/; rename <*.jpg>, $_ }'
  • 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-07T03:48:03+00:00Added an answer on June 7, 2026 at 3:48 am

    Don’t use rename with a glob. Use scalars. Try to assign the file name to a new variable before the substitution and rename the old name to the modified one, like this:

    perl -e'while(<*.JPG>) { ($new = $_) =~ s/JPG$/jpg/; rename $_, $new }'
    

    Check output with ls -1:

    IMG_0178.jpg                                                                                                     
    IMG_0182.jpg                                                                                                
    IMG_0183.jpg                                                                                              
    IMG_0184.jpg                                                                                               
    IMG_0186.jpg
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn the basics of JavaScript I cant figure out why this
I'm new at php and I'm trying to figure out of this is a
I've spent a long time trying to figure out this issue, I need a
I've spent a couple hours now trying to figure this out, but I just
Alright, I've spent about 5 hours trying to figure this out. Absolutely none of
I am new to Perl and still trying to figure out how to code
I have been racking my brains trying to figure this out for days and
I'm trying out mocha for my JS testing, and I'm getting this weird fragment:
This problem came up when trying out the Unit Testing capabilities of SQLDeveloper. When
I am just getting started with JS Unit Testing and am trying out qUnit.

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.