You are not logged in.
Is it possible to do this?
To setup a folder to be watched so that whenever you download any new rar, zip files or other archive formats into that folder it'll automatically extract them (like mac's stuffit expander).
Offline
Why don't you try with a script.
#!/bin/bash
time=4
while [ 1 ]
do
unp *.{zip,gz,rar}
rm *.{zip,gz,rar}
sleep $time
done
Add the script to the directory of your downloads files.
If important you install unp: http://aur.archlinux.org/packages.php?ID=3939
The script remove the compress files.
Good luck!
Offline
Why don't you try with a script.
#!/bin/bash time=4 while [ 1 ] do unp *.{zip,gz,rar} rm *.{zip,gz,rar} sleep $time done
Add the script to the directory of your downloads files.
If important you install unp: http://aur.archlinux.org/packages.php?ID=3939
The script remove the compress files.Good luck!
Cool!
Thank You!
Offline
Thank you! Damn useful script
But I'm wondering - in order to extract every downloaded file do I need to have this script running all the time in the background? Or is it somehow possible to trigger it only when a new file appears in the directory?
Offline
May be incron can help you there. Never used it though.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
unp *.{zip,gz,rar} rm *.{zip,gz,rar}
What happens if one of your ZIP files contains another ZIP file?
Offline
But I'm wondering - in order to extract every downloaded file do I need to have this script running all the time in the background? Or is it somehow possible to trigger it only when a new file appears in the directory?
See fsniper (in AUR).
Offline
#!/bin/bash
time=4
while [ 1 ]
do
unp *.{zip,gz,rar}
if [ $? -eq 0 ]
then rm *.{zip,gz,rar}
fi;
sleep $time
done
This helps avoiding problems when downloading password protected rar etc... Or do you want to remove all files although they could not been opened?
{ Github } {Blog and other stuff }
Offline
I would recommend using inotifywait to watch the folder, then run something like xtract to extract the files. Have this script running all the time:
#!/bin/bash
watchfolder=/downloads
while (( 1 )); do
inotifywait -e modify -e moved_to -e create $watchfolder
xtract $watchfolder/*
sleep 10
done
A little crude but should work. Better, edit the xtract script so it writes the extracted folders to a different folder instead of the watched one, or use xtract --inter You might also want to auto-remove the extracted files so they aren't extracted again.
Personally, I prefer just associating xtract with archive types, so when I open them in my file manager they are instantly extracted to a subfolder - no interaction. You might find that just as easy.
Last edited by IgnorantGuru (2010-06-20 15:35:41)
Offline
Personally, I prefer just associating xtract with archive types, so when I open them in my file manager they are instantly extracted to a subfolder - no interaction. You might find that just as easy.
Thank you! I've been trying to get incron and fsniper to execute my script but they wouldn't listen I'm a bit of a newbie so i think that will do
Thanks
Offline
IgnorantGuru wrote:Personally, I prefer just associating xtract with archive types, so when I open them in my file manager they are instantly extracted to a subfolder - no interaction. You might find that just as easy.
Thank you! I've been trying to get incron and fsniper to execute my script but they wouldn't listen I'm a bit of a newbie so i think that will do
I've never used those, only inotifywait, which is very reliable. But inotifywait doesn't start anything for you, it just watches until the target changes, then quits. So you use it in a script. The example script I gave above needs to be saved as "myscript" for example, then started manually with:
bash myscript &
That will keep it running. Or you can have it start automatically each time you login, which will vary depending on what kind of setup you have (desktop, etc). That's if you do decide you want the stuffit type folder.
Offline