You are not logged in.

#1 2015-10-10 15:33:20

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

File-Roller extract multiple .zip into same directory?

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? tongue


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

#2 2015-10-10 15:41:05

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: File-Roller extract multiple .zip into same directory?

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; done

Then move all into a single dir, this should work:

mkdir foo
find . -name '*.jpg' -print0 | xargs -0 mv {} -t foo

Last edited by graysky (2015-10-10 15:41:30)

Offline

#3 2015-10-10 15:49:05

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:

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; done

Then 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

#4 2015-10-10 17:28:31

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: File-Roller extract multiple .zip into same directory?

Apparently not, or noone uses them.

Offline

#5 2015-10-10 18:31:45

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

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


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

#6 2015-10-10 19:12:29

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: File-Roller extract multiple .zip into same directory?

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 :?

Last edited by graysky (2015-10-10 19:13:01)

Offline

#7 2015-10-10 19:17:57

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:
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 sad 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

#8 2015-10-10 21:10:54

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: File-Roller extract multiple .zip into same directory?

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

#9 2015-10-11 06:48:27

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

progandy wrote:

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

#10 2015-10-11 06:51:12

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: File-Roller extract multiple .zip into same directory?

@op - You are making this entirely too difficult.  Use a script.

Offline

#11 2015-10-11 07:07:06

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:

@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

#12 2015-10-11 07:43:10

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: File-Roller extract multiple .zip into same directory?

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-zips

I don't understand why you think that is too much work?

Offline

#13 2015-10-11 08:55:48

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:

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-zips

I 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 yikes


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

#14 2015-10-11 09:03:15

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: File-Roller extract multiple .zip into same directory?

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.

Last edited by graysky (2015-10-11 09:05:37)

Offline

#15 2015-10-11 17:11:00

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:
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; done

I 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 hmm


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

#16 2015-10-14 12:12:18

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

graysky wrote:
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 smile

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 foo

In 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 found

What am I doing wrong? yikes

@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 ? hmm

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

#17 2015-10-14 12:14:58

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: File-Roller extract multiple .zip into same directory?

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

#18 2015-10-14 12:16:45

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

progandy wrote:

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 ? hmm


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

#19 2015-10-14 12:27:13

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: File-Roller extract multiple .zip into same directory?

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

Last edited by progandy (2015-10-14 12:28:24)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#20 2015-10-14 12:39:16

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

progandy wrote:

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-zips2

in process-zips2:

for i in "$@"; do
  echo "$i"
done

output:

process-zips2 *.zip
bash: process-zips2: command not found
./process-zips2 *.zip
bash: process-zips2: command not found

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

#21 2015-10-14 12:45:53

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: File-Roller extract multiple .zip into same directory?

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

#22 2015-10-14 12:51:31

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: File-Roller extract multiple .zip into same directory?

progandy wrote:

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
done

My 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

Board footer

Powered by FluxBB