Renaming help required

i am doing some renaming of files and folders and i hoped somebody could help me.

i wish to remove characters from the beginning and/or end of the file name and the folder name.

i've searched the forums and found a way to do it using a button or regular expression for the files and another button or regular expression for the folders - is there anyway to do both with a single button or regular expression?

the file rename doesn't work with folders and if i modify it so that it does - it removes the extension from file names.

i would also like to know if there is a way to take a file name and folder name and remove a string from a part of the file name and move it to another - i.e. part 1 interesting thing.avi to interesting thing part 1.avi

thank you

Try this tool:
bulkrenameutility.co.uk/Main_Intro.php

thank you for your prompt reply - i am looking at that tool now.

i was hoping to achieve this using directory opus though

You can specify whether the rename is to operate on files or folders by using the type argument in the rename command.

Type=files Type=dirs
So add type=files to the end of the the files rename command,
and add type=dirs to the end of the folders rename command.
Both renames can then be put in the same button, just use separate lines.

thank you very much - i'll give it a try

i'm back. :smiley:

i'll post the code from my button then i'll tell you my woes.

Rename TYPE=files REGEXP PATTERN ".(.+)(..*)#{dlgstring|Enter Number of Characters to Remove at Start}" TO "\1\2" AUTORENAME

this pops up with a box and asks me how many characters to remove.

i tried pasting -

Rename TYPE=dirs REGEXP PATTERN ".(.+)(..*)#{dlgstring|Enter Number of Characters to Remove at Start}" TO "\1\2" AUTORENAME

after the first line - now i get two pop up boxes and only the files get renamed - i think it may have something to do with dlgstring ?

if i can get it working for folders how can i make the button so i only have i pop up box ?

thank you

[quote="jens7677"]Try this tool:
bulkrenameutility.co.uk/Main_Intro.php[/quote]

i've had time to try it out and it is really very good - you don't have to know how to write expressions - a lot of the options are available from drop down menus. it took 10 minutes to achieve success with the rename which i'd been struggling with all day in directory opus.

i'd much prefer to use directory opus but in this case bulk rename utility was powerful and easy

Try this:

@set numChars = {dlgstring|Enter Number of Characters to Remove at Start} Rename TYPE=files REGEXP PATTERN ".(.+)(\..*)#{$numChars}" TO "\1\2" AUTORENAME Rename TYPE=dirs REGEXP PATTERN ".(.+)#{$numChars}" TO "\1" AUTORENAME

Edit: Changed \1\2 on the last line to just \1 -- the old version was incorrect, but in a harmless way.

thank you very much that worked beautifully

do you know a way of moving the first part of a filename to the end?

should i ask this in a seperate post?

my original post probably had too many parts to it :confused:

This will move however many characters you specify from the start of the names to the end of the names:

@set numChars = {dlgstring|Enter Number of Characters to Move to the End} Rename TYPE=files REGEXP PATTERN "(.)(.+)(\..*)#{$numChars}" TO "\2\1\3" AUTORENAME Rename TYPE=dirs REGEXP PATTERN "(.)(.+)#{$numChars}" TO "\2\1" AUTORENAME

BTW: I noticed a (harmless) mistake in my previous button. I've corrected the post above.

thank you