Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Quick command to rename files

Featured Replies

So I recently decided to start using MediaBrowser for all of my movies.  I'm still in the evaluation phase trying to decide if this is the direction I want to go with my HTPC.  Anyway, one of the requirements for MediaBrowser is that all artwork be either '.jpg' or '.png'.  According to the MediaBrowser web page, '.jpeg' is not an accepted extension.  Of course, I had thousands of Folder.jpeg files and needed a way to quickly rename them all to Folder.jpg.  After some experimentation, I came up with the following command that works for all file names, including those with spaces and apostrophes:

 

find /mnt/disk1 -regex '.*\.jpeg' | while read n ; do echo "File $n" ; rename .jpeg .jpg "$n" ; done

 

This will find all files that have a '.jpeg' extension on disk1 and rename them with a '.jpg' extension.  I have amassed my collection of movie poster art and backdrops over the course of many years.  I cannot even begin to tell you how nervous I was when I hit the enter key (even though I did a ton of testing on quarantined files).  However, despite my concerns, it worked great.

 

Anyhow, I love my unRAID box and don't usually have too much to contribute to the community.  Thought this was something others might find useful.  Of course, if you want to search for '.jpeg' files in other locations, change the /mnt/disk1 to something else.

 

EDIT: fixed spelling errors.

I learned something new from your post. 

 

I never knew a "rename" command existed.  It is certainly not standard on older unixes.

 

The more common command to rename a file or directory is the "mv" command.    You would have had to deal with the embeded quotes, so your solution is better.

I'm like Joel I've always used the mv command.

 

As for your command not helping I think I might use it, but tweak it a little to find and move some files for me since I have a habit of using airvideo to encode some of my movies. So just think you did help the community. ;)

  • Author

I'm like Joel I've always used the mv command.

 

As for your command not helping I think I might use it, but tweak it a little to find and move some files for me since I have a habit of using airvideo to encode some of my movies. So just think you did help the community. ;)

 

I typically use the mv command as well.  However, I was having a difficult time getting mv to work.  Too many special characters, spaces, etc.  I couldn't quite get the mv command to work in all cases.  ???  Rename worked like a charm.

 

 

rename has a -n option that will make it do nothing, so you could test the command using that option (and possible -v for more output)

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.