Shell script for unzip


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script for unzip
# 1  
Old 07-26-2007
Shell script for unzip

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 advanace.

Venkat
# 2  
Old 07-26-2007
try this
----------------------
CURRENDIR=/home/anupl/sri

cd $CURRENDIR
rm $CURRENDIR/zipfiles 2>/dev/null

ls -1 *.zip
if [ $? -eq 0 ]
then
echo ".zip file found"
ls -1 $CURRENDIR/*.zip > $CURRENDIR/zipfiles
for i in `cat $CURRENDIR/zipfiles`
do
unzip $i
done
fi
if [ $? -eq 1 ]
then
echo "NOT found"
fi
---------------------
# 3  
Old 07-26-2007
try like this

ls -1 *.zip > filelist
for filename in `cat filelist`
do
unzip $filename > temp
mv temp newdir/$filename
done
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unzip the .zip file without using unzip utility in UNIX

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)
Discussion started by: Ganesh L
3 Replies

2. Shell Programming and Scripting

Using Shell Script in place of Perl script to Unzip the zip files.

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)
Discussion started by: naveen.dasu
3 Replies

3. Shell Programming and Scripting

Unzip the input file using shell script (ksh)

Hi, I need help in unziping input file through shell script. I had written script, which checks for input file extention. If Extension is "zip" or "gz", then I want to do unzip/uncompress that file. Caould you please let me know that, How to unzip a file through shell script (ksh). Thanks... (16 Replies)
Discussion started by: Poonamol
16 Replies

4. Shell Programming and Scripting

How to unzip files from folder in shell script (ksh)?

I have a folder (C:\shellprg\input\) containing .CSV, .zip, .gz files. 1] I want to find all .zip/.gz files from folder (C:\shellprg\input\). 2] unzip/uncompress files into the same folder (C:\shellprg\input\) through shell script. I am using below commands for unzip files, unzip <filename>... (2 Replies)
Discussion started by: Poonamol
2 Replies

5. Shell Programming and Scripting

Unzip in bash script

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... (17 Replies)
Discussion started by: vidhyamirra
17 Replies

6. Shell Programming and Scripting

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

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)
Discussion started by: sureshg_sampat
5 Replies

7. Shell Programming and Scripting

SFTP / UNZIP script issues

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)
Discussion started by: Peanutz
0 Replies

8. Shell Programming and Scripting

Script to unzip specific files

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)
Discussion started by: stumpyuk
1 Replies

9. HP-UX

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

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)
Discussion started by: sureshg_sampat
5 Replies

10. Shell Programming and Scripting

unzip in script using rsh

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)
Discussion started by: speedieB
4 Replies
Login or Register to Ask a Question