Clients submit large (1.5gigs, >10,000 files) zip file with their directory structure from clients OUTPUT directory.
I want to bash unzip to my INPUT directory, preserving their directory structure also, BUT NOT ENTIRE directory structure.
Example, if their zip file contains the files:
/home/base/data/output/able/file1.xml
/home/base/data/output/able/file2.xml
/home/base/data/output/able/file3.xml
/home/base/data/output/baker/file1.xml
/home/base/data/output/baker/file2.xml
/home/base/data/output/baker/file3.xml
/home/base/data/output/charlie/file1.xml
/home/base/data/output/charlie/file2.xml
/home/base/data/output/charlie/file3.xml
(this goes on for thousands of files in about a dozen unique directories)
I want to unzip them to my INPUT directory as below:
../input/able/file1.xml
../input/able/file2.xml
../input/able/file3.xml
../input/baker/file1.xml
../input/baker/file2.xml
../input/baker/file3.xml
../input/charlie/file1.xml
../input/charlie/file2.xml
../input/charlie/file3.xml
So far I tried:
unzip BIGFILE.zip /output/ input --(*) before and after /output/
which does unzip all xml files with the directory structure of able/baker/charlie
, etc.
HOWEVER, it also unpacks the entire file structure BEFORE /output
:
../input/home/base/data/output/able/file1.xml
../input/home/base/data/output/able/file2.xml
../input/home/base/data/output/able/file3.xml
../input/home/base/data/output/baker/file1.xml
../input/home/base/data/output/baker/file2.xml
../input/home/base/data/output/baker/file3.xml
../input/home/base/data/output/charlie/file1.xml
../input/home/base/data/output/charlie/file2.xml
../input/home/base/data/output/charile/file3.xml
Probably can't be done in a one liner, but haven't found any scripts that would read in the partial directory a couple thousand files, then unzip them to a specific directory.
Any thoughts?