Rename Parent Folder as Selected File/Folder (or vice versa)

This button will rename the parent folder to the same name as the selected file/folder (excluding file extension):

<?xml version="1.0"?> <button backcol="none" display="label" textcol="none"> <label>Rename Parent Folder</label> <tip>Rename the Parent Folder to the same name as the Selected File/Folder</tip> <icon1>#newcommand</icon1> <function type="normal"> <instruction>@firstfileonly</instruction> <instruction>Rename {filepath$|..|noterm} TO {file$|noext}</instruction> </function> </button>

This button will rename the selected file/folder to the same name as the parent folder:

<?xml version="1.0"?> <button backcol="none" display="label" textcol="none"> <label>Rename File to Parent</label> <tip>Rename the Selected File/Folder to the same name as the Parent Folder</tip> <icon1>#newcommand</icon1> <function type="normal"> <instruction>Rename TO="{parent}.{ext}" FILEINFO </instruction> </function> </button>

Click here if you don't know how to add the buttons to your toolbars.

Hi, these functions will be very usefull but it missing for renaming multiples files from a Parent Folder Name, so a RegEx rename command with a counter can be seriously usefull.e.g: "name_of_previous_folder-01.jpg","name_of_previous_folder-02.jpg","name_of_previous_folder-03.jpg"...

it Gives a function button like that:

<?xml version="1.0"?>
<button display="both" label_pos="right" separate="yes">
	<label>Rename by Parent Folder Name and Counter</label>
	<tip>Changes files by Parent Folder Name and Counter</tip>
	<icon1>16</icon1>
	<function type="normal">
		<instruction>Rename REGEXP PATTERN &quot;(.*)\.(.*)&quot; TO &quot;{parent}-[#].\2&quot; FILEINFO NUMBER=01 </instruction>
	</function>
</button>

Nice End year 2010 partys ! :slight_smile:

1 Like

Thanks for these. I have been searching but the DOPUS 10 Help is not complete and doesn't show anything.
Could you please say what FILEINFO does in:

Rename TO="{parent}.{ext}" FILEINFO

Most of the commands are documented in the Opus 9 manual:

gpsoft.com.au/help/opus9/default.htm

gpsoft.com.au/help/opus9/default ... ommand.htm

Also, most of the Rename arguments correspond to things you can turn on/off in the Rename (Advanced) window.

How can I rename multiple parent folders?
I have 1000s of files for which parent folders are to be renamed.. pls help

[quote="indigo"]How can I rename multiple parent folders?
I have 1000s of files for which parent folders are to be renamed.. pls help[/quote]

Please give us more info on what you are trying to do.

How have you already got the list of those 1000s of files, either in a file collection or in a filtered flat-view window? Or do you need to work out a way to do that first?

What is the criteria for knowing which file within a folder should be used as that folders name (instead of some other file within the same folder)?

Hi,

I have files like this...

Folder\Filename

A\123.avi
B\153.avi
C\143.avi

All the folders have only one file inside.
I can create a search and get all the files in a lister. Now I want to rename the parent folders of each file to the respective file names.
Whats the best way to do that?

Use this as the command:

dopusrt /cmd Rename {filepath$|..|noterm} TO {file$|noext}

i.e. Same as the first button/command in the thread, except:

[ul][li]@firstfileonly removed, so that it acts on all selected files, not just the first one.

(In a normal directory, it makes sense to ignore any accidental extra selections, since the one-and-only parent folder can only be renamed to one of the file's names, but that doesn't apply for what you're doing with multiple files in different folders.)

[/li]
[li]dopusrt /cmd added tot he start of the line.

(This is a workaround/kludge. Without it, the first directory gets renamed automatically but then the Rename window appears for the others. Using "dopusrt /cmd" changes when the {file$} etc. arguments are turned into actual filenames, which avoids whatever is causing the problem.)[/li][/ul]

The command should be run with the files selected, and will then rename those files' parent directories.