When I use the context menu to extract compressed files on PCManFM, I would like it to automatically create a folder and put the extracted files in it, like it used to happen in Nautilus back when I was able to use it, instead of putting all the extracted files in the current folder, which can cause a mess. Is there any way?
-
Workaround: Create new folder, move zip into it, click "Extract here". Move zip back if necessary. – wjandrea Dec 03 '16 at 01:12
-
You might want to try Nemo. It's a fork of Nautilus with some bugs fixed and older features added back – wjandrea Dec 03 '16 at 01:13
2 Answers
I found a nice workaround by creating a desktop entry. Create a file in ~/.local/share/applications
named extract.desktop
with the following contents:
[Desktop Entry]
Name=Extract to folder
Comment=Extract archive to a folder with the same name
Exec=file-roller -h %F
Terminal=false
Type=Application
Icon=file-roller
StartupNotify=true
MimeType=text/plain;
Now in PCManFM, right click the archive > Open With...
From Other
, select Extract to folder
Once you do this, when you right click any archive of the same type you will see the Extract to folder option
in the menu.
Notes:
- You will have to repeat the
Open with...
action once for each file type - You can right click and extract multiple archives in the same time
- The action will appear in the start menu >
Other
. Clicking it will not do any harm - If you use other archive manager than the default File Roller, you will have to modify the desktop entry
Exec
andIcon
entries. See details about entries here
-
Works! I set this as the default app to open with so all i need is to double-click to extract into folder. Very satisfied, thanks! – krivar Nov 15 '21 at 18:26
-
Great answer. Somehow the pcmanfm devs say this is a file-roller thing, but the extract here part seems to be hardcoded anyway, so we're stuck with this solution. However; i needed the icon to be "org.gnome.FileRoller" to work for me properly (I looked in the fileroller.desktop entry which one to choose) so maybe you'll need to update if it shows a blank one. YMMV, just so you know. – Kay Urbach Oct 20 '23 at 18:09
Another solution would be to create an action in PCmanFM-Qt. I used the script for extracting from the Manjaro Wiki and changed the line:
Exec=atool --extract-to=%d %f
to
Exec=file-roller -h %F
The first line is to extract here, and the second, extract to folder. You may also want to change the action's name.
From the Manjaro Wiki:
Creating custom actions
Before creating the actions (which are desktop files), first create its directory/folder by copy-pasting the below command in terminal:
mkdir -p ~/.local/share/file-manager/actions
“Extract” custom action
Create and edit the action file (extract.desktop) either by using file manager or by issuing these terminal commands one at a time (replace juffed with your text editor if it’s different):
touch ~/.local/share/file-manager/actions/extract.desktop
juffed ~/.local/share/file-manager/actions/extract.desktop
Paste the below content in extract.desktop:
[Desktop Entry] Type=Action Name[en]=Extract Icon=package-x-generic Profiles=profile-zero;
[X-Action-Profile profile-zero] MimeTypes=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-bzip;application/x-bzip-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/x-cd-image;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/x-gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-rar;application/x-rar-compressed;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-xz;application/x-xz-compressed-tar;application/x-zip;application/x-zip-compressed;application/x-zoo;application/zip;multipart/x-zip; Exec=atool --extract-to=%d %f Name[en]=Default profile SelectionCount==1
This will uncompress the selected archive into the current directory. (You may need to change the icon in the above code if you don't have oxygen icons.)
https://wiki.manjaro.org/index.php?title=PCmanFM-Qt&mobileaction=toggle_view_desktop