I already posted a button to move files into named folder, and putting all the contents in a parent directory. You can find the link here:
This time, I'll explain how to make user commands for these and implement them in contextual menus (in this case, I prefer user commands as the functions can be assigned from everywhere, and the day you have to change something, you only change the code once).
So here we go.
First, let's create the user commands that we will need:
Go to Settings -> Customize
In the command tab, go to "user" line.
Add these user commands (I let you choose the text for the tips as I all mine are in french ):
AutoMoveToDir
Type: Standard
@nofilenamequoting
@runonce @set Folder={file|noext}
@runonce CreateFolder READAUTO=no "{file|noext}"
Copy MOVE TO ".\{$Folder}"
@keydown:shift
Rename {$Folder}
(this command will let you move all selected files to a new folder called from the name of the first file. Note that holding shift key will let you rename the folder at the end of the command if you need)
ContentsToCurrentFolder
Type: Standard
@dirsonly
@nofilenamequoting
Copy MOVE FILE "{filepath$}\*" HERE
Delete QUIET NORECYCLE
(this command will let you move the contents of the selected folders to the current one and delete the empty folders at the end of the command)
MoveToParentFolder
Type: MS-DOS Batch
@set ChildPath={sourcepath$|noterm}
@runmode hide
Copy MOVE * TO ..
Go ..
@keydown:shift
@keydown:none
rmdir {$ChildPath}
(this command will let you move all contents from a folder to the parent one and delete the empty folder. Note that when holding shift key, the folder will not be removed)
Now the user commands are set, you can go to "Context Menu" tab to set up the commands for all listers context menus.
Show the "Lister Context" menu. Right click on the menu, and select Insert New -> New Button
Edit the button with this code:
MoveToParentFolder
You can also add this button to both "Lister ZIP Context" & "Lister FTP context" context menus.
Next step is to set the buttons for files/folders context menus:
Go to Settings -> FileTypes
Edit the "All Folder" line. Go the "Context Menu" tab and choose New.
Put this code for the ContentsToCurrentFolder:
@runonce ContentsToCurrentFolder
Same as last step, edit now the "All Files & Folders" line.
Create this new command to use AutoMoveToDir:
@runonce AutoMoveToDir
You can also create a new command to move the selected files/folders to the parent directory:
Copy MOVE TO ..
That's all you normally have to do. If you want, you can also set up a Three button to call the 3 commands described in this thread (use only the user commands names as the function to set up the buttons).
These commands are really handy to move files all around when working with downloads, archives, etc.... Let's give it a try if you will, and if anyone has any improvement ideas, don't hesitate to share them!
Hope this thread is helpful... (note that some of the user commands are not from me... a lot was already discussed on the forum, it's the way I ended up implementing them)