cancel
Showing results for 
Search instead for 
Did you mean: 

Using Cron to unzip files

spark43
Dabbler
Posts: 23
Thanks: 2
Fixes: 1
Registered: ‎30-07-2007

Using Cron to unzip files

I have just started using my Payh webspace and uploaded PhpGedView.zip to my httpdocs folder but cannot get unzip to work.
After studying both Cron tutorials I created the following command:
'/usr/bin/unzip -a httpdocs/PhpGedView.zip httpdocs/ > httpdocs/pgvunzip-log 2>&1'
which produces the log file containing:
'Archive:  httpdocs/PhpGedView.zip caution: filename not matched:  httpdocs/'.
Searching the web finds several instances of 'filename not matched' but they all relate to unzipping multiple files using wildcards.
Do I need a longer path name to the file location?
Thanks
David





2 REPLIES 2
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Using Cron to unzip files

I think the problem is that you've asked for directory httpdocs to be extracted from the ZIP file and, of course, it isn't in there.
To fix this you need to include "-d" after the ZIP archive specifier as in
'/usr/bin/unzip -a httpdocs/PhpGedView.zip -d httpdocs/ > httpdocs/pgvunzip-log 2>&1'
to tell unzip that what follows is the location to which files are to be extracted. Since the file list is omitted all files in the archive will be extracted.
David too
David
spark43
Dabbler
Posts: 23
Thanks: 2
Fixes: 1
Registered: ‎30-07-2007

Re: Using Cron to unzip files

Thanks David that was it.
It inflated to over 4000 files in minutes.
It would have taken me days doing it manually.
Thanks again
David