Announcement

Collapse
No announcement yet.

Method to rename files?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Method to rename files?

    I have 30,000+ pictures that all have either a ".JPG" or a ".jpg".

    Is there an easy method (or program) that can go in and change them ALL to ".JPG", without having to go to each individual directory to do it? Just let the program loose from the main pictures directory?

    #2
    "ScottyK" asked Nov 15th 2011, 06:11 PM : http://www.kubuntuforums.net/showthr...-rename-photos

    You could use the same applications to change the extension. Lookin an application - KRename: You could pick the top level directory and the KRename will pick all files from the subfolders.
    Have you tried ?

    - How to Ask a Question on the Internet and Get It Answered
    - How To Ask Questions The Smart Way

    Comment


      #3
      Thanks, I didn't know that Krename could do all the directories under the main directory. I saw the option, checked it, and it went through the entire list. Thanks!

      Comment


        #4
        For what it's worth (since you already SOLVED this) you can also use find and rename to do this as well. Like so:
        Code:
        find . -exec rename -v 's/\.JPG/\.jpg/' {} +
        This "find"s all files in the current directory and its subdirectories, passing them in groups to the "rename" command. The "rename" command takes a perl-like pattern to appy to all the files it receives, in this case the pattern says (s)ubstitute ".jpg" for ".JPG" for all files passed to the command. Rename will only touch files that match the pattern. The -v will make rename print out each file it renames and what it renames it to.

        You can make the command slightly more efficient at the cost of some duplication like so:
        Code:
        find . -name "*.JPG" -exec rename -v 's/\.JPG/\.jpg/' {} +
        This will cause find to only return and pass to "rename" files named <something>.JPG but if the pattern changes, you'll have to make changes in both places.

        Comment

        Working...
        X