Mass File Depression Maintaining Directory Structure

Tim Chase blinux.list at thechases.com
Tue Jan 11 15:49:23 UTC 2011


> After reading "man zip", I am still not able to uncompress a load
> of NLS books in the specific way required for the task I am working
> on.

I'm not familiar with the NLS zip structure which makes it hard 
to determine what you are trying to do.  The good news is that 
there's almost positively a straight-forward way to do what you 
want...I just need to understand what that is ::smile::


> I just want to uncompress the directory so it can be accessed
> by a DB-player's software.

There are a couple possibilities:

1) an NLS file is a zip-file containing a bunch of files that are 
in subdirectories within the zip-file.

In this case, you may want to do any of the following:

1a) extract just the directory structure without extracting the files

1b) extract the files into a flat structure without the hierarchy 
stored in the zip file, or

1c) most likely (based on what I *think* you're describing) there 
are multiple directories stored in the zip-file and you'd like to 
extract just one of them.  To do this, you can specify which 
files to extract on the command-line (assuming the zip-file 
contains a subdirectory structure of 
"contained_folder/subfolder/" with the things inside that you want):

   unzip source.zip contained_folder/subfolder/*

which will only extract the files given on the command-line, not 
*all* the files in the zip-file.

2) an NLS file is a zip-file containing a bunch of files that 
have no hierarchy and you would like to put them in a subdirctory 
when you uncompress them so that they don't litter your current 
working-directory with the files.

> unzip file01.zip -d /home/riverwind/holder
>
> The file decompressed right enough, but there was no directory.
> Instead the actual files were decompressed.

This is what I would expect from this command and it addresses #2 
above.  Your command says "unzip the contents of file01.zip and 
put any contained files/directories/hierarchy in 
/home/riverwind/holder (creating that folder if needed)".


It might help to include a portion of the output of

   unzip -t file01.zip

You can pipe that into a file to copy/paste/attach if you want

   unzip -t file01.zip > file01_contents.txt

That way we can get a clearer understanding of the structure 
inside the zip-file and craft a better solution.

-tim







More information about the Blinux-list mailing list