what is here the menings of btw ? when i rightclick on tar package , it tells extract or extract to
…and i can make tar from right menu … on every folder
Do you mean “Extract Files Here”? It should mean extract to the current folder or a specified folder.
However, this is just the name of the menu entry. The actual name of the command is determined by the archiver you are using. The OP doesn’t specify the name of the archiver, as they are using a script that links to their actual archiver.
It’s just my own custom script lol, it tries to smartly extract files to a subfolder based on some conditions. I should probably rename the menu entry tbh it’s confused me a couple times.
More about the script
I like it better than the lxqt-archiver based extract here function of pcmanfm-qt, both because it gives me more control and I understand how it works, and because sometimes the built in extract function doesn’t extract to subfolders and just dumps a bunch of files into the directory where the archive is located, which I practically never want (And if I would want it, I would want it only when i explicitly request it).
Here’s the script if you’re interested.
#!/bin/sh
#
#Smartly extracts files to a single subfolder; named after archive by default, but named after the folder inside the archive if it was already arranged into a subfolder within the archive.
subfolder="$(echo $@ | cut -d '.' -f1)"
mkdir "$subfolder"
cd "$subfolder"
file="../$@"
notify-send "extracting $(basename "$@")..."
for var in "$file"
do
echo filename "$var"
if [ -f "$var" ] ; then
case "$var" in
*.tar.bz2) tar xvjf "$var" ;;
*.tar.gz) tar xvzf "$var" ;;
*.bz2) bunzip2 "$var" ;;
*.rar) unrar x "$var" ;;
*.gz) gunzip "$var" ;;
*.tar) tar xvf "$var" ;;
*.tbz2) tar xvjf "$var" ;;
*.tgz) tar xvzf "$var" ;;
*.zip) 7za x "$var" ;;
*.Z) uncompress "$var" ;;
*.7z) 7z x "$var" ;;
*.lzh) lha x "$var" ;;
*) echo "I don't know how to extract '$var'..." ;;
esac
else
echo "'$var' is not a valid file!"
fi
done
#Ensure good folder structure
if [ $(ls -1q | wc -l) == 1 ]; then
if mv -f ./* ../ ; then
cd ../
rm -r "$subfolder"
else
mv ./*/* ./
mv ./*/.* ./
rm -r "$subfolder"
fi
fi
notify-send "$(basename "$@") has been extracted."
So to summarize. If I want the extract files (~/.local/share/file-manager/actions/extract.desktop) action from my OP to be part of a submenu, I can do:
Where the extract.desktop, another-action.desktop and yet-another-action.desktop from within ~/.local/share/file-manager/actions/ would be the submenu items.
It uses the mimetypes setting from the desktop entries it refers to to determine if it shows up or not.