Batch rename: Filename to lower case

Ask for help and post your question on how to use XnView Classic.

Moderators: helmut, XnTriq, xnview

Post Reply
pschsch
Posts: 1
Joined: Mon Jan 19, 2004 4:31 pm

Batch rename: Filename to lower case

Post by pschsch »

Problem: Multiple change of file names doesn't work: I'd like to change names from capital letters (comlete file name incl suffix) to small letters. I have choosen this option but no results.
After having changed suffix (e.g. from JPG to gif) it worked to change capital letters to small letters in file names. Then I had to rename the (wrong) gif suffix to the right jpg suffix. That's better than DOS (rename command for suffixes, but single rename of file names), but a little complicated... It would be fine to have a tool that's able for batch multiple change of file names from complete capital letters to small.
crazytb
Posts: 124
Joined: Wed Oct 15, 2003 2:51 am
Contact:

Post by crazytb »

Hey! The problem isn't only with XnView.

On my Linux system, I open a terminal and change to a directory inside FAT partition. So, I try to rename some file:

Code: Select all

$ mv Filename.EXT filename.ext
It asks me if I want to overwrite the file and, even if I say yes, the filename case remains intact. I need to do exactly what you said: rename to anything else and, then, rename back to final name.

I don't know exactly how "mv" or "XnView" renames or moves the files, but I know that renaming a file in Windows Explorer does not have this problem. I don't know with sure how Pierre can solve this without changing a lot of things in code. Maybe something like:

Code: Select all

if filename_before.toLowerCase == filename_after.toLowerCase()
      UseASpecialRenameSystemCall;
else
      UseCurrentCode;
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

From my point of view, the batch rename has some issues, which can give users a hard time:

--- Problem when swapping name

When renaming

image01.gif -> image02.gif
image02.gif -> image01.gif

XnView will show a warning message box, asking whether file image01.gif should be overwritten. Once this is confirmed with "Yes", the file is overwritten and lost. This situation should be avoided by a "triangular swap" using temporary name, i. e. while renaming, all the files are temporarily renamed to something different (Step1) and then to the intended name (Step2).

Example:

Step 1
image01.gif -> ~image01.~gif
image02.gif -> ~image02.~gif

Step 2
~image01.~gif -> image02.gif
~image02.~gif -> image01.gif

Sure enough, this is more complicated than the current (direct) renaming and if something goes wrong, the user is in a bit of trouble, but it's the same, now (or even worse). Also, I think that this would fix the lower case bug reported by pschpsch, since in step 1 the files are really renamed and not just lower or uppercased.


--- Problem with place holder '*'

Currently, the place holder '*' stands for the whole filename including the extension. This is no good: E.g. try to put all file to lower case: You enter '*' as new file name and choose the option "Lower case filename". The result will be:
Image01.gif -> image01.gif.gif
Image02.gif -> image02.gif.gif

Please note the '.gif.gif' extension in the new names, reason is that '*' stands for the whole filename. Instead, '* should be the name without extension.
Post Reply