Renamer: Shortening filenames while moving them?

This is a place for users to discuss Altap Salamander. Please feel free to ask, answer questions, and express your opinion. Please do not post problems, bug reports or feature requests here.
SerenusZeitblom
Posts: 2
Joined: 10 Aug 2006, 16:30

Renamer: Shortening filenames while moving them?

Post by SerenusZeitblom »

Hi there,

I've got a bunch of graphc files that have a "_XY" at the end of their names - XY is a language identifier f. e. "_EN" for English, "_PL" for Polish.

Now I have to put them in separate langue folders "EN", "PL" - without the identifier: Copy all "<name>_EN.png" into "EN" folder as "<name>.jpg".

Can this be done using Salamander without the need to rename each file individually?

TIA

Franz-Josef
omega
Posts: 196
Joined: 09 Dec 2005, 19:21

Post by omega »

You can't move and rename the files simultaneously. What you can do is replace the files _EN.png first using the batch renamer then move them to the EN folder. Repeat the same for the other countries.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Post by Jan Rysavy »

Yes, it is possible using the Renamer plugin.

0. create subdirectories EN, PL, etc. (Commands > Create Directory)
1. select all desired files (Edit > Select)
2. start Renamer (Plugins > Renamer > Batch Rename)
3. set Mask to *_en.* (only _en files will be affected, look at Preview list)
4. set Options > Rename Relative Paths
5. set New name to en\$(OriginalName)
6. set Search for to _en (this step will remove the _en appendix)
7. press the Rename

Then you can change the EN string to PL (step 4, 6, 7) and Rename again.
Last edited by Jan Rysavy on 12 Aug 2006, 12:13, edited 2 times in total.
Lukas Cerman
Plugin Developer
Plugin Developer
Posts: 36
Joined: 11 Dec 2005, 20:08
Contact:

Post by Lukas Cerman »

There is even more convenient way to do this, using regular expressions. See:

0. Create subdirectories EN, PL, etc. (Commands > Create Directory)
1. Select desired files at once, it means all EN,PL,XX files at once.
2. start Renamer (Plugins > Renamer > Batch Rename)
3. Turn on `Rename Relative Path' in `Options' menu.
4. Turn on `Regular expression' check box.
5. In `Search for' write: (.*)_(..)(\..*?)$
6. In `Replace with' write: $2\$1$3
7. Press `Rename'.

Thats all.

To explain the regular expression. All terms in round brackets are saved in internal variables accesed by $1,$2... from the `Replace with'. The numbers are given by order in the regular expression.

.* stands for any string (. dot is any char, * means any repetetition of previous term)
_ stands for _
.. stand for right two characters, each dot for one
\. stands for .
*? stands for nongreedy repetition
$ stands for end of string
Last edited by Lukas Cerman on 11 Aug 2006, 12:27, edited 1 time in total.
Post Reply