You are not logged in.
Hey there, I am running XFCE with Thunar and file-roller and downloaded a pack of pictures which were compressed and split into several 50mb .zip files. I now want to extract all .zip files at once and within the same folder (so that the content of the 20 .zip files if then inside one folder).
I can only manage to extract each individual .zip file into its own folder which means I will have 20 folders which each contain the pictures. I would now have to move the pictures from those 20 folders into 1 folder manually which is a pain.
Any suggestions? ![]()
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Shell scripts are you friends; file-roller isn't setup for this. Assuming your zip files have no spaces or illegal characters:
for i in *.zip; do unzip $i; doneThen move all into a single dir, this should work:
mkdir foo
find . -name '*.jpg' -print0 | xargs -0 mv {} -t fooLast edited by graysky (2015-10-10 15:41:30)
Offline
Shell scripts are you friends; file-roller isn't setup for this. Assuming your zip files have no spaces or illegal characters:
for i in *.zip; do unzip $i; doneThen move all into a single dir, this should work:
mkdir foo find . -name '*.jpg' -print0 | xargs -0 mv {} -t foo
Thanks for that, is there any gui archiver that can handle such tasks?
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Apparently not, or noone uses them.
Offline
Apparently not, or noone uses them.
Oh boy.. I am mostly downloading files/archives like that. Writing/Running a script everytime is time consuming.... :S
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Stefan Husmann wrote:Apparently not, or noone uses them.
Oh boy.. I am mostly downloading files/archives like that. Writing/Running a script everytime is time consuming.... :S
The whole point of a script is to automate repetitive tasks such as what you describe. How is that more time consuming than your alternative... considering you already have some code on which to build :?
Last edited by graysky (2015-10-10 19:13:01)
Offline
Utini wrote:Stefan Husmann wrote:Apparently not, or noone uses them.
Oh boy.. I am mostly downloading files/archives like that. Writing/Running a script everytime is time consuming.... :S
The whole point of a script is to automate repetitive tasks such as what you describe. How is that more time consuming than your alternative... considering you already have some code on which to build :?
Well, I need to run the terminal, browse into the folder, run the script, go back into thunar to further work with the files (that is if the script works fine with all files / folder structures).
OR
I open thunar, go into the folder, right click -> extract, done.
@edit: peazip-gtk2 seems to do the task.. it is also the only real feature rich solution when it comes to gui compressing/unarchiving.
peazip-gtk2 should be in the official repo
although it still has some bugs.
Last edited by Utini (2015-10-10 20:08:33)
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Thunar should provide custom menu entries. You can create your shellscript with commandline parameters and assign it to a custom action. You can even add a file dialog to choose the extraction target with e.g. zenity.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Thunar should provide custom menu entries. You can create your shellscript with commandline parameters and assign it to a custom action. You can even add a file dialog to choose the extraction target with e.g. zenity.
While I would and have done such things on windows, I feel not confident/ready enough to do this on arch to do on my own.
Is there a very detailed wiki topic or guide for how to do this ?
Thanks for your help !
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
@op - You are making this entirely too difficult. Use a script.
Offline
@op - You are making this entirely too difficult. Use a script.
@graysky, how would the process of extracting such archives look like when using a script ? I guess the scritp gets saved somewhere, so I would open terminal, browse into the desired directory, open the script and modify it so it fits for the current task, I then run the script. But everytime I would need to modify/make sure the script actually works ?
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Your task is to 1) extract multiple zips and 2) move pics to an alternative location, yes? I gave you two lines of code that will do this for you. If general, you can place them in a shell script ~/bin/process-zips or the like and simply:
cd /path/to/zips
process-zipsI don't understand why you think that is too much work?
Offline
Your task is to 1) extract multiple zips and 2) move pics to an alternative location, yes? I gave you two lines of code that will do this for you. If general, you can place them in a shell script ~/bin/process-zips or the like and simply:
cd /path/to/zips process-zipsI don't understand why you think that is too much work?
But it is not just about .jpg files. basically any file extension would need to work with that script ![]()
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
...downloaded a pack of pictures which were compressed and split into several 50mb .zip files. I now want to extract all .zip files at once and within the same folder (so that the content of the 20 .zip files if then inside one folder).
...I would now have to move the pictures from those 20 folders into 1 folder manually which is a pain.
Your original post suggested images... you can remove the -name switch and use -type f but that will move all files including the parent zip files.
Last edited by graysky (2015-10-11 09:05:37)
Offline
Utini wrote:...downloaded a pack of pictures which were compressed and split into several 50mb .zip files. I now want to extract all .zip files at once and within the same folder (so that the content of the 20 .zip files if then inside one folder).
...I would now have to move the pictures from those 20 folders into 1 folder manually which is a pain.
Your original post suggested images... you can remove the -name switch and use -type f but that will move all files including the parent zip files.
The "unzip -d /randomdir/" would let me unzip everything in one folder?
So my script could look somehow like this?
mkdir unzipped-files
for i in *.zip; do unzip -d /unzipped-files/ $i; doneI have no experience yet with shell scripting but that script would/should do the following:
create dir /unzipped-files/ in the current directory
unzip everything with "unzip -d /unzipped-files/" ... which should unzip each zip into the one and single folder /unzipped-files/ ?
I am sure my script is wrong though lol.. cant test and play atm as I won't be home for the next 3 days ![]()
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Utini wrote:...downloaded a pack of pictures which were compressed and split into several 50mb .zip files. I now want to extract all .zip files at once and within the same folder (so that the content of the 20 .zip files if then inside one folder).
...I would now have to move the pictures from those 20 folders into 1 folder manually which is a pain.
Your original post suggested images... you can remove the -name switch and use -type f but that will move all files including the parent zip files.
So I am back and have time to play with this around ![]()
1. in my /home/user/ dir I created /bin/.
2. nano ~/bin/process-zips
#!/bin/bash
for i in *.zip; do unzip $i; done
mkdir foo
find . -name '*.r*' -print0 | xargs -0 mv {} -t fooIn this care I have to unzip a punch of .zip files which will then contain .r01, .r02,.... .rar files.
I then open a terminal in the desired folder and run process-zip:
process-zip
bash: process-zip: command not foundWhat am I doing wrong? ![]()
@edit: oh god no... I thought I needed to "source" the script first and this happend:
source ~/bin/process-zips
unzip: cannot find or open *.zip, *.zip.zip or *.zip.ZIP.
No zipfiles found.
mv: cannot stat ‘{}’: No such file or directory
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/xbuild/12.0/bin/xbuild.rsp’
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/3.5/xbuild.rsp’
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/2.0/xbuild.rsp’
mv: will not overwrite just-created ‘foo/user.reg’ with ‘./.config/teamviewer10/user.reg’
mv: will not overwrite just-created ‘foo/system.reg’ with ‘./.config/teamviewer10/system.reg’
mv: will not overwrite just-created ‘foo/userdef.reg’ with ‘./.config/teamviewer10/userdef.reg’
mv: will not overwrite just-created ‘foo/mozilla.rsa’ with ‘./.mozilla/firefox/bz4ibjc5.default/extensions/https-everywhere@eff.org/META-INF/mozilla.rsa’
mv: will not overwrite just-created ‘foo/install.rdf’ with ‘./.mozilla/firefox/bz4ibjc5.default/extensions/https-everywhere@eff.org/install.rdf’now I have a "foo" folder in "/home/sneida/" containing various files that it found somewhere in my "/home/sneida/" dir and decided to randomly move them.... Any chance to undo this or will a lot be broken now ? ![]()
Last edited by Utini (2015-10-14 12:16:07)
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
You'll have to set the PATH to include ~/bin and make process-zips executable (chmod +x)
https://wiki.archlinux.org/index.php/En … s#Per_user
Last edited by progandy (2015-10-14 12:27:28)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
You'll have to set the PATH to include ~/bin and make process-zips executable (chmod +x)
https://wiki.archlinux.org/index.php/En … s#Per_user
Thanks I will give it a try BUT
I thought I needed to "source" the script first and this happend:
source ~/bin/process-zips
unzip: cannot find or open *.zip, *.zip.zip or *.zip.ZIP.
No zipfiles found.
mv: cannot stat ‘{}’: No such file or directory
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/xbuild/12.0/bin/xbuild.rsp’
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/3.5/xbuild.rsp’
mv: will not overwrite just-created ‘foo/xbuild.rsp’ with ‘./.wine/drive_c/windows/mono/mono-2.0/lib/mono/2.0/xbuild.rsp’
mv: will not overwrite just-created ‘foo/user.reg’ with ‘./.config/teamviewer10/user.reg’
mv: will not overwrite just-created ‘foo/system.reg’ with ‘./.config/teamviewer10/system.reg’
mv: will not overwrite just-created ‘foo/userdef.reg’ with ‘./.config/teamviewer10/userdef.reg’
mv: will not overwrite just-created ‘foo/mozilla.rsa’ with ‘./.mozilla/firefox/bz4ibjc5.default/extensions/https-everywhere@eff.org/META-INF/mozilla.rsa’
mv: will not overwrite just-created ‘foo/install.rdf’ with ‘./.mozilla/firefox/bz4ibjc5.default/extensions/https-everywhere@eff.org/install.rdf’now I have a "foo" folder in "/home/sneida/" containing various files that it found somewhere in my "/home/sneida/" dir and decided to randomly move them.... Any chance to undo this or will a lot be broken now ? ![]()
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
now I have a "foo" folder in "/home/sneida/" containing various files that it found somewhere in my "/home/sneida/" dir and decided to randomly move them.... Any chance to undo this or will a lot be broken now ? hmm
Some things will be broken since you don't know where the files were before the move. It won't cripple your system, but some things like teamviewer, wine and a few firefox extensions may not work properly anymore. You might have to remove your .wine directory and reinstall teamviewer and some firefox extensions, it might be easier to start with a new firefox profile, too.
I suggest you use 'unzip "$file" -d foo' instead of 'find' and 'mv'
Edit: By the way, you can also use commandline parameters, e.g.
~$ cat ./extract-args
for i in "$@"; do
echo "$i"
done
~$ ./extract-args *.zipLast edited by progandy (2015-10-14 12:28:24)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
now I have a "foo" folder in "/home/sneida/" containing various files that it found somewhere in my "/home/sneida/" dir and decided to randomly move them.... Any chance to undo this or will a lot be broken now ? hmm
Some things will be broken since you don't know where the files were before the move. It won't cripple your system, but some things like teamviewer, wine and a few firefox extensions may not work properly anymore. You might have to remove your .wine directory and reinstall teamviewer and some firefox extensions, it might be easier to start with a new firefox profile, too.
I suggest you use 'unzip "$file" -d foo' instead of 'find' and 'mv'Edit: By the way, you can also use commandline parameters, e.g.
~$ cat ./extract-args for i in "$@"; do echo "$i" done ~$ ./extract-args *.zip
Mkay, lets get suprised on what will not work after the next reboot :S
So I in ~/.bashrc:
export PATH="${PATH}:/home/sneida/bin"Then:
sneida@_____ ~]$ nano ~/bin/process-zips2
[sneida@_____ ~]$ chmod +x ~/bin/process-zips2in process-zips2:
for i in "$@"; do
echo "$i"
doneoutput:
process-zips2 *.zip
bash: process-zips2: command not found
./process-zips2 *.zip
bash: process-zips2: command not foundSetup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
Please read the wiki page better. You'll have to restart bash after modifying the bashrc, if you change .*profile, you'll have to re-login.
Edit: Until you are a bit better at scripting, don't use commands that alter the filesystem (mv, cp, rm, unzip) directly. First prefix them with echo and make a tesrun to verify it displays the desired commands. Then remove the echo and let it run for real.
Edit: My script was incomplete, don't forget the hashbang for bash. (It only displays one argument per line, nothing else)
Last edited by progandy (2015-10-14 12:51:54)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Please read the wiki page better. You'll have to restart bash after modifying the bashrc, if you change .*profile, you'll have to re-login.
Thank you that worked, I also manged to create a working script thanks to you:
for i in "$@"; do
unzip -n "$i" -d foo
doneMy next task will be to add this script to the right-click context menu. Thanks for your help !
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline