Is there a way to extract .rar files to a folder named after the .rar file?
Moderators: Hacker, petermad, Stefan2, white
Is there a way to extract .rar files to a folder named after the .rar file?
I use WinRAR to extract .rar files and was wondering if there's a way to replicate the same WinRAR workflows within Total Commander.
Workflow 1:
Right-click rar file and select "extract to folder" (or use a keyboard shortcut).
Total Commander creates a folder with the same name as the rar file's name.
Workflow 2:
Extract the contents of the rar file to the folder it's located at without creating a new folder.
Workflow 1:
Right-click rar file and select "extract to folder" (or use a keyboard shortcut).
Total Commander creates a folder with the same name as the rar file's name.
Workflow 2:
Extract the contents of the rar file to the folder it's located at without creating a new folder.
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Here are two external commands for that:
You can use the em_command in a Button in the button bars, as a Keyboard shortcut, in the Main menu and the Start menu and the Directory hotlist - But you can NOT use it in the context menu (Right-click).
The commands work for all supported archive formats, not just .rar.
Run:
for Help about the cm_UnpackFiles command parameters
Code: Select all
[em_extract-to_folder_with_archivename]
cmd=cm_UnpackFiles
param=/GT="%O\"
button=wcmicons.dll,31
menu=Extract archive under cursor to folder in curent folder with same name as archive
[em_extract-to_current_folder]
cmd=cm_UnpackFiles
param=/GT="."
button=wcmicons.dll,31
menu=Extract archive under cursor to current folder
The commands work for all supported archive formats, not just .rar.
Run:
Code: Select all
hh.exe %COMMANDER_PATH%\TOTALCMD.CHM::dlg_choosecommand.htm
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Is there a way to extract .rar files to a folder named after the .rar file?
There's also a manual way via the Alt+F9 (Unpack files) dialog. Prerequisite is that both TC panels are showing the same directory, i.e. the one where the archive resides.
If the option "Unpack each archive to a separate subdir (name of the archive)" is checked, your workflow 1 would be covered. Unchecking the option this option would cover your second workflow.
If the option "Unpack each archive to a separate subdir (name of the archive)" is checked, your workflow 1 would be covered. Unchecking the option this option would cover your second workflow.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Is there a way to extract .rar files to a folder named after the .rar file?
You can also just delete the proposed directory, then the directory in the active panel will be used.Prerequisite is that both TC panels are showing the same directory
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Is there a way to extract .rar files to a folder named after the .rar file?
2petermad
Ah yes, thanks. I always forget about that.
Ah yes, thanks. I always forget about that.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Cool! Thanks both! There's only one thing I'm missing now compared to WinRAR. Is there a way to do "Browse with Total Commander" by default when I double left-click a .rar archive?
I tried doing the "right-click > Open with > Total Commander > Always" method but that ends up launching a new instance of Totalcmd instead of opening it in the current panel like when you do "right-click > Browse with Total Commander"
I tried doing the "right-click > Open with > Total Commander > Always" method but that ends up launching a new instance of Totalcmd instead of opening it in the current panel like when you do "right-click > Browse with Total Commander"
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Configuration / Packer / Treat archives like directoriesJorge24 wrote: 2025-03-24, 17:25 UTC Cool! Thanks both! There's only one thing I'm missing now compared to WinRAR. Is there a way to do "Browse with Total Commander" by default when I double left-click a .rar archive?
I tried doing the "right-click > Open with > Total Commander > Always" method but that ends up launching a new instance of Totalcmd instead of opening it in the current panel like when you do "right-click > Browse with Total Commander"
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Now it's perfect, thanks! Is there way to also to create a ZIP file and place it on the same folder where the files are at?
I tried the method of deleting the proposed directory that works with extracting but it said "You cannot copy a file to itself!"
Is there a setting/ini file where I can set the proposed directory? or that's hard coded?
I tried the method of deleting the proposed directory that works with extracting but it said "You cannot copy a file to itself!"
Is there a setting/ini file where I can set the proposed directory? or that's hard coded?
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Associate Ctrl+Alt+F5 with the cm_PackFiles command in Options > Misc > Redefine hotkeys. After doing that you can press Ctrl+Alt+F5 to create an archive in the same directory level. It's the same command that's associated with Alt+F5, but pressing the additional Ctrl key changes the behavior of that function (leaving out the path).Jorge24 wrote: 2025-03-24, 19:35 UTCIs there way to also to create a ZIP file and place it on the same folder where the files are at?
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Is there a way to extract .rar files to a folder named after the .rar file?
ohh neat! Is there a way to pass an argument or something to cm_PackFiles so that I can leave out the path by pressing just Alt+F5?
I read there's a T="path" argument but when I leave it blank like T="" it still adds the other panel's path
I read there's a T="path" argument but when I leave it blank like T="" it still adds the other panel's path
Re: Is there a way to extract .rar files to a folder named after the .rar file?
2Jorge24
You need a / before the T - like this: https://tcmd.madsenworld.dk/packfilestocurrentdir.png
this will create the archive file in the source folder.
Remember to click the button with the green check-mark to save the change.
You need a / before the T - like this: https://tcmd.madsenworld.dk/packfilestocurrentdir.png
this will create the archive file in the source folder.
Remember to click the button with the green check-mark to save the change.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Is there a way to extract .rar files to a folder named after the .rar file?
ohh I see, thanks! It's all working perfect now! Do you add a slash because each argument needs a slash before it? or does the slash in this case just represent the current directory?
Re: Is there a way to extract .rar files to a folder named after the .rar file?
Yes, a slash is needed before the T. It's used to mark the start of a command switch, cm_PackFiles being the command and /T being the switch (or parameter). It's the same thing as for many Windows command line commands.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Is there a way to extract .rar files to a folder named after the .rar file?
You only need one slash even if you use more parameters - like: /DRBT="."Do you add a slash because each argument needs a slash before it?
Help wrote:cm_PackFiles
All the options shown in the dialog box can be passed as parameters (starting with a slash). Each of the checkbox options takes an optional parameter 1 or 0.
T="target name": path and file name of the archive. Use T="" or T="." to pack to source directory with default name, or T="c:\path\." to pack to given path with default name.
D: Also pack path names (only recursed)
R: Recursively pack subdirectories
S: Multiple disk archive (ZIP, 7-ZIP, ARJ, RAR, ACE)
M: Move to archive
X: Create self extracting archive
O0..4,7,8: Overwrite options, numbers as in the F5 copy dialog box. 5,6 and 9 are not supported.
A: Create separate archives, one per selected file/dir
B: Leave out base directory when packing folders
C: Encryption method: 0=old ZIP enryption, 1=AES128, 2=AES192, 3=AES256, -1=default method last chosen by the user
P="password": provide password (needs /C option)
G: Go: Start copying immediately
E="extension": packer type as shown in the pack dialog
F="options": Additional 7-Zip options like setting the pack method or header compression, e.g. /F="-m0=PPMD -mhc=on"
Z0..10: ZIP compression rate, 0=stored, 10=LZMA. Only used for ZIP, GZ and TGZ (the latter two 1..9 only)
cm_UnpackFiles
All the options shown in the dialog box can be passed as parameters (starting with a slash). Each of the checkbox options takes an optional parameter 1 or 0.
T="path": Destination path, MUST be in double quotes. use T="." to unpack to the location of the archive
D: Unpack the path names of the files
O0..4,7,8: Overwrite options, numbers as in F5 copy dialog. 5, 6 and 9 are not supported.
S: Extract each archive into a separate subdirectory
P="Password": Enter password (only ZIP, RAR and internal 7-Zip)
A="Password": specify password for archive (encrypted filenames, only 7-Zip internal)
G: Go: Start unpacking immediately
W="wildcard": Extract only files of this type. Double quotes " must be specified twice, e.g. for names with spaces: /W="file1.txt ""file 2.txt"" file3.txt". Special case: /W="" unpacks selected files from an open archive (like F5).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Is there a way to extract .rar files to a folder named after the .rar file?
It's not the same thing as for many Windows command line commands. The slash is used to mark the start of the command switches (plural).Dalai wrote: 2025-03-25, 09:18 UTC Yes, a slash is needed before the T. It's used to mark the start of a command switch, cm_PackFiles being the command and /T being the switch (or parameter). It's the same thing as for many Windows command line commands.
In fact, using only one slash is the syntax. Adding more slashes doesn't do anything. These commands do the same:petermad wrote: 2025-03-25, 10:38 UTCYou only need one slash even if you use more parameters - like: /DRBT="."Do you add a slash because each argument needs a slash before it?
cm_packfiles /D0R0
cm_packfiles /D0 R0
cm_packfiles /D0 /R0