My script works like this.
1. First for loop - checks if it can access zip parameters in a directory
2. If unzip fails for any of the file in that directory, then it goes inside the second for loop - to list which file is that
3. My doubt is..Is there any way I can tell status for every 5000 files in the first for loop. like processed 5000 files...10000 files etc...for monitoring
4.I can very well keep a counter and do this logic in second for loop, since it loops every file.but this will execute only when there are corrupted files
Any inputs pls...
Thanks
Last edited by pludi; 02-09-2010 at 06:54 AM..
Reason: code tags, please...
Apologize : Replace i with another unused letter !
I think you could try to avoid the first check (unzip -qT $j/\*), believe that it should'nt slow-down the script to much and you don't need to look twice if there is an error with unzip.
I suggest (some modif. to make it more readable)
Instead if I use as I mentioned in the below code it gives the correct output.
performance :
if I run the code with the 2 loops - 1. scan all the files in the directory with one unzip system call
2. If any of the dir has corrupted files, loop the second directory and list the files
It takes 0m5.186s this time to execute 1.3 lakhs files
If i remove the outer loop, it takes 1m46.280s to execute 1.3 lakh files
Our server will hold data close to 1.4 TB. There is a performance hit in these 2 ways of implementation. Thats the reason, I wanted to count the files in the outer for loop (while testing the unzip for all the files in one sub-directory)
Frans, your help pls.
Thanks,
Vidhya.
Last edited by Scott; 02-10-2010 at 04:42 AM..
Reason: Code tags
Can you tell me how many directories and how many files you have in each one.
a command like
would increment n by the number of files in the dir.
Please put code tags around code
Apologize : Replace i with another unused letter !
I think you could try to avoid the first check (unzip -qT $j/\*), believe that it should'nt slow-down the script to much and you don't need to look twice if there is an error with unzip.
I suggest (some modif. to make it more readable)
Not only is ls unnecessary, but it will break your script if any filenames contain whitespace or other pathological characters.
I have .zip file, i want to list all the files archived in the zip file. unzip utility is not working for me in unix.
Please help me resolve this issue
Thanks
ganesh. (3 Replies)
Hi Expert,
We have some shell scripts which Internally uses Perl Script to Unzip the source zip files which comes to inbound directory. So now our requirement is to avoid the dependency on Perl Script and us Shell Script to unzip the files. I have the Perl script with me attached can some one... (3 Replies)
Hi All
I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX).
I don't have unzip cmd available in my curent Unix version
Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file .
Please elaborate on the commands aval and... (5 Replies)
Hi everyone,
i'm having a little trouble wih my first shell script ever.
So the point of that script is to:
-Archive Zip files in a directory
-Remove txt files from that directory
-connect through sftp and a rsa key to a remote server
-download a couple of files
-unzip downloaded files
... (0 Replies)
i have two lines in my rc.local file that are
wget -O/<path>/<file>.zip url://domain.com
unzip -o /<path>/<file>.zip
the wget works fine, but the unzip won't work. when i copy/pase the unzip line to the prompt it works fine. i thought that maybe the unzip was running before the wget... (0 Replies)
As part of an audit at work I need to review a lot of Windows workstations. One thing I need to do is review all of the .doc files. My problem is that I guessed a number of these files would be in zip archives. This is the case but they are mixed in with a lot of other file types that I am not... (1 Reply)
All, I'm having 4 .zip files that are coming from FTP. I need to unzip those files and put that files into another folder. Can anyone help me how to write a shell script to check wether .zip files are located in FTP folder, if condition true then how to unzip and put it in another folder. Thanks in... (2 Replies)
Hi All
I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX).
I don't have unzip cmd available in my curent Unix version
Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file .
Please elaborate on the commands aval and... (5 Replies)
I'm getting the following errors when I try to write a script to unzip some zip files. When I use the free trial copy of the commerical winzip program, however, they work fine. When I use -l or -t on unzip it indicates no errors. When I use the -o switch interactively from the bash command line it... (1 Reply)
Hi
I have searched usr/bin and usr/sbin to try to find unzip but I cannot find it.
My script is using the ksh #!/usr/bin/ksh but when I rsh to another box it cannot find unzip to unzip to a new archive, but I can unzip files when I am using a telnet session on the box.
The error message... (4 Replies)