Create a folder named from parent folder & Move selected file in

I need to create a button for create a folder named from it's parent folder + move selected files in that folder and make that folder into a rar files.
example: Folder A/item 1.mp3, item 2.mp4, item 3.pdf
Select
item 1.mp3,
item 2.mp4,
item 3.pd
After click that button

  1. Create a folder named 'Folder A'
  2. All Selected files move into That 'Folder A'
  3. Create 'Folder A.rar' form 'Folder A'
  4. Delete the 'Folder A'
    After All that action I will have a single 'Folder A.rar' file in the parent 'Folder A'
    Like That: Folder A/Folder A.rar

Here you go

"{apppath|WinRAR}WinRAR.exe"

Just add the RAR parameters you need. Should be a DOS button, btw.

Hi lxp Thanks for the reply, I use your code in a button, but it only run the WinRAR program.
Capture

"I need to create a button for create a folder named from it's parent folder"

please any one help me!!

Copy MOVE HERE CREATEFOLDER "{sourcepath|nopath|noterm}"
@runonce:Copy "{sourcepath|nopath|noterm}" ARCHIVE=.rar,keepfolder HERE
@runonce:Delete "{sourcepath|nopath|noterm}" QUIET

OMG!!! Hi Jon your code is perfectly done what I want. Thank you so much.

Brilliant, as always.
khalidhosain - Please allow me to use this thread as I had more or less the same question.

How would it read, given the same example, to have the .rar file named after the folder (not root folder), i.e. in this case FolderA.rar
then move that folder to its parent folder.
then the actual folderA plus sub-folders be deleted

So FolderA contains sub-folders and files, all are packed in a .rar file (folderA.rar)
FolderA moved to its parent folder.

Thanks.

That's what it does already.

Thanks for getting back on this.

Sorry for the confusion, but what I meant is that the .rar file is named after the folder.
(FolderA with subfolders being zipped to FolderA.rar, not named after the source folder)
The .rar file is now named of the parent.

SnagIt-13052019%20104544

The rar is already named after the folder in Jon's command. The folder is created by the button, and is named after the source folder.

If you just want to archive up a folder that already exists, into an archive named after the folder, that's built in to the right-click menus (if turned on in Preferences). Or you can run a command like this:

Copy ARCHIVE=.rar HERE

Or variants of that command, as needed (e.g. add the ,keepfolder from Jon's command if you want it to keep the extra folder inside the archive).