GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Button to move files in folder named from file

Here is a simple button to move selected files to a new folder based on the name of the first selected file. The folder name can be changed after the move command if shift key is held down.

The second button was already posted somewhere on this forum and move all files to the parent directory and delete the folder.

<?xml version="1.0"?>
<button backcol="none" display="both" separate="yes" textcol="none" type="three_button">
	<label>Déplacement Rapide</label>
	<icon1>#opentoolbar</icon1>
	<button display="both">
		<label>Déplacer dans un dossier auto</label>
		<tip>Déplacer dans un dossier du nom du fichier</tip>
		<icon1>#makedir</icon1>
		<function type="normal">
			<instruction>@nofilenamequoting </instruction>
			<instruction>@runonce @set Folder={file|noext}</instruction>
			<instruction>@runonce CREATEFOLDER &quot;{file|noext}&quot;</instruction>
			<instruction>Copy MOVE TO &quot;.\{$Folder}&quot;</instruction>
			<instruction>@keydown:shift </instruction>
			<instruction>Rename {$Folder}</instruction>
		</function>
	</button>
	<button backcol="none" display="both" textcol="none">
		<label>Déplacer dans le dossier parent</label>
		<tip>Déplacer les fichiers dans le dossier parent et supprimer le dossier counant</tip>
		<icon1>#opentoolbar</icon1>
		<function type="batch">
			<instruction>@set ChildPath={sourcepath$|noterm}</instruction>
			<instruction>@runmode hide</instruction>
			<instruction>Copy MOVE * TO ..</instruction>
			<instruction>Go ..</instruction>
			<instruction>rmdir {$ChildPath}</instruction>
		</function>
	</button>
</button>

Hope this can help!
(sorry, tips are in french :wink:)

just a little change, the button couldn't work in the case folders are broswed automatically after creation.

READAUTO=no is added when creating the folder.

<?xml version="1.0"?> <button backcol="none" display="both" separate="yes" textcol="none" type="three_button"> <label>Déplacement Rapide</label> <icon1>#opentoolbar</icon1> <button display="both"> <label>Déplacer dans un dossier auto</label> <tip>Déplacer dans un dossier du nom du fichier</tip> <icon1>#makedir</icon1> <function type="normal"> <instruction>@nofilenamequoting </instruction> <instruction>@runonce @set Folder={file|noext}</instruction> <instruction>@runonce CREATEFOLDER READAUTO=no &quot;{file|noext}&quot;</instruction> <instruction>Copy MOVE TO &quot;.\{$Folder}&quot;</instruction> <instruction>@keydown:shift </instruction> <instruction>Rename {$Folder}</instruction> </function> </button> <button backcol="none" display="both" textcol="none"> <label>Déplacer dans le dossier parent</label> <tip>Déplacer les fichiers dans le dossier parent et supprimer le dossier counant</tip> <icon1>#opentoolbar</icon1> <function type="batch"> <instruction>@set ChildPath={sourcepath$|noterm}</instruction> <instruction>@runmode hide</instruction> <instruction>Copy MOVE * TO ..</instruction> <instruction>Go ..</instruction> <instruction>rmdir {$ChildPath}</instruction> </function> </button> </button>

You can edit the original post if you want. (Editing is enabled in the download forums.)

Is it possible to put this into a right-click context menu?
I found this page, but I'm not sure how it would work with XML:

EDIT ---- SOLUTION --- MANAGED TO FIGURE IT OUT USING THIS INFO:
gpsoft.com.au/help/opus10/in ... t_Menu.htm

Pretty easy, just follow below:
Settings > File Type > All Files and Folders > Context Menu > Run an Opus function > Paste code below into box > done!

@nofilenamequoting @runonce @set Folder={file|noext} @runonce CREATEFOLDER READAUTO=no "{file|noext}" Copy MOVE TO ".\{$Folder}" @keydown:shift Rename {$Folder}

I'm super happy this mod exists...
older apps like "Files2Folder" don't seem to work with Win8,
there's no other options!!

Now there is!
Thx Dopus!

1 Like

To put the commands on a context menu, paste the codes above on to a toolbar temporarily, then edit the buttons to get the commands out of them. You can then use the File Type editor and paste the same commands into new context menu items, using the Run an Opus Function type.