[SOLVED] Merging Zip Files?

Forum rules
Before you post please read this

[SOLVED] Merging Zip Files?

Postby karmafarmer on Thu Jul 12, 2012 2:44 pm

I'm trying to organise my BBC Micro disk images. The current folder setup goes like this (parenthesis is inside zip file):-

~/bbcg/Acornsoft/Hopper.zip (Acornsoft/Hopper.ssd)
~/bbcg/Acornsoft/Snapper.zip (Acornsoft/Snapper.ssd)
~/bbcg/Superior/Citadel.zip (Superior/Citadel.ssd)
~/bbcg/Superior/Repton.zip (Superior/Repton.ssd)

There's loads more folders and zip files, that's why a little command or script would be helpful. Is there a way to run a command or a script that would take the entire folder bbcg and output either a zip file or folder with the following heirarchy?

~/bbcg/Acornsoft/Hopper.ssd
~/bbcg/Acornsoft/Snapper.ssd
~/bbcg/Superior/Citadel.ssd
~/bbcg/Superior/Repton.ssd

or into a Zip file with a similar format:-

~/bbcg.zip (Acornsoft/Hopper.ssd)
~/bbcg.zip (Acornsoft/Snapper.ssd)
~/bbcg.zip (Superior/Citadel.ssd)
~/bbcg.zip (Superior/Repton.ssd)

So each software house has it's own folder, full of SSD "disk" files from that house...

Thanks

Karl
Last edited by karmafarmer on Thu Jul 12, 2012 4:35 pm, edited 1 time in total.
“To do good is noble. To tell others to do good is even nobler and much less trouble.”
― Mark Twain
karmafarmer
Level 1
Level 1
 
Posts: 17
Joined: Sun Aug 14, 2011 12:32 pm

Linux Mint is funded by ads and donations.
 

Re: Merging Zip Files?

Postby DrHu on Thu Jul 12, 2012 3:51 pm

karmafarmer wrote:Is there a way to run a command or a script that would take the entire folder bbcg and output either a zip file or folder with the following hierarchy?

I am not sure what that file type is (not an ssd disk ? is it..)
    EDIT: Ok, I think I've found it ssd (single sided image files, diskette sizes !)
http://bbc.nvg.org/files.php3
http://www.simplehelp.net/2008/12/15/ho ... -in-linux/
    --archive file creation/extraction utilities..

      The desktop (Linux) for Gnome or Kde, also has a zip filer (fileroller : Gnome), for example..
      Kde will have something similar
      --and other desktop styles as well

        To get a hierarchical archive dump on a Linux system, the default application is tar
So, it looks like you want a larger file archive (appending all the separate files (.ssd)
This utility may work..
http://www.hjsplit.org/linux/

Also the UNIX/Linux utility cat (catenate) or copy /b (binary file) likely will be ok as well
http://www.devdaily.com/unix/edu/examples/cat.shtml
cat x1.zip, x2.zip all.zip (result file)
copy x1.zip x2.zuip xxall.zip (result file)
--or copy /b *.zip all.zip
Last edited by DrHu on Thu Jul 12, 2012 4:16 pm, edited 2 times in total.
User avatar
DrHu
Level 16
Level 16
 
Posts: 6710
Joined: Wed Jun 17, 2009 8:20 pm

Re: Merging Zip Files?

Postby xenopeek on Thu Jul 12, 2012 4:12 pm

I'd do this by creating a new empty directory next to bbcg, called bbcgnew (so they are both subdirectories of the same directory). Then open a terminal and go to the bbcgnew directory. Then run this command:
Code: Select all
for file in $(find ../bbcg -name *.zip); do unzip $file; done

It will find all the zip files in the bbcg directory and unzip them in the bbcgnew directory. After I run the above with your example files in ~/bbcg, it has the files in one directory per software house as you wanted:
Code: Select all
vincent@katya ~/bbcgnew $ tree
.
├── Acornsoft
│   ├── Hopper.ssd
│   └── Snapper.ssd
└── Superior
    ├── Citadel.ssd
    └── Repton.ssd

2 directories, 4 files

You can then zip this however you want.

PS. Fond memories of my old BBC Acorn Electron :wink:
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14713
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Merging Zip Files?

Postby karmafarmer on Thu Jul 12, 2012 4:34 pm

Thanks, Vincent!

Absolutely beautiful. Did exactly what I wanted. Hundreds of BBC Games, all sorted into folders in a second!

I love those old games, and what's crazy, my kids do too!

Thanks so much :) Now I'm off to retrogame...
“To do good is noble. To tell others to do good is even nobler and much less trouble.”
― Mark Twain
karmafarmer
Level 1
Level 1
 
Posts: 17
Joined: Sun Aug 14, 2011 12:32 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests