简体   繁体   中英

How can we specify the unzip or 7za command in linux to extract multiple zip files into one folder while keeping all duplicates?

I currently have about 10 zip files I would like to extract into one folder. Each zip file contains around 1000 images. As a result, lots of the names of the images are duplicated. For example, in the first zip file, we have things like Img.jpg, Img(1).jpg, Img(2).jpg . I know that to extract multiple zip files into a single folder, I would do something like:

unzip '*.zip'

However, when it tries to put a file from the first zip file that has the same name as a file in the second zip file, it starts to ask:

replace duplicatefile.mp4? [y]es, [n]o, [A]ll, [N]one, [r]ename:

At this point, what do I do if I want to keep ALL files, including the duplicates, and possibly have them named to image(1).jpg instead?

In short, is there a way to call the unzip command on all the zip files, have them extracted into a single folder, without losing any files due to same names?

Thanks.

Invoke unzip --help for details.

But it appears unzip *.zip -n should do the trick?

(Make sure it does what you expect before going ahead!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM