check if exists a .ZIP file and unzip it using ftp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting check if exists a .ZIP file and unzip it using ftp
# 1  
Old 05-05-2005
check if exists a .ZIP file and unzip it using ftp

hi
this is my question
i have my script what have to verify the existence of a .ZIP file in a extern server (using ftp). if there are .ZIP files, the idea is what the script "unzip" them in the specified folder.

THE PROBLEM IS what the script doen´t unzip the .ZIP files, and besides, delete them (which is terrible).

please help me, i need to know what do i have to do to fix it.
this is the script:

#-----
# Verifica Existencia de Archivo en Servidor Externo
#--
VExiArc()
{
#--------------------------------------------------
# Verifica existencia de archivos ZIP y los descompacta
#--------------------------------------------------
ls ${DTMPINP}/*.zip > ${DTMPINP}/.zip.si
if [ -s "${DTMPINP}/.zip.si" ]; then
for uz in `ls ${DTMPINP}/*.zip`
do
unzip -l $uz|tail -3| head -1|read peso fecha hora nn
narc=`basename $uz`
wzip=".zip"
narc=${narc%%$wzip}
print $narc| awk '{print substr($0,1,8)"."substr($0,9,3)}'|read nok
if [ $nok = $nn ]; then
unzip -u -a -L -j $uz -d /sybase/DTMP/INP
else
nerr=$nn
echo $nok" "$nerr >> ${DTMPINP}/.ftp.nomarc.err
fi
rm $uz
narc=`basename $uz`
BorArc
done
fi
rm ${DTMPINP}/.zip.si



#--------------------------------------------------
# Verifica existencia de archivos en general
#--------------------------------------------------
ls ${DTMPINP}>${DTMPINP}/.ftp.nomarc

if [ -s "${DTMPINP}/.ftp.nomarc" ]; then
EXISTE=$TRUE
fi
}
#-----
# 2  
Old 05-05-2005
unzip must be available on the server, in the chroot ftp directory.
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. UNIX for Dummies Questions & Answers

ftp - check if file on remote exists (skip overriding)

Hello, I have a script that uploads a file from local to remote place using ftp. The problem is that, if on remote host there is a file called the same as the one I want to upload, the ftp program overrides that file. But I don't want to override nothing (even if the remote file is older,... (3 Replies)
Discussion started by: spiriad
3 Replies

3. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

4. Shell Programming and Scripting

FTP check if file exists and log it

Hi, I need to create a script that checks if a file exists on an offsite server which only has ftp enabled. I was originally going to use perls Net::FTP class but the client does not have perl installed nor wants it. So, I have to use a shell script which logs into the server, then ... (1 Reply)
Discussion started by: gseyforth
1 Replies

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

6. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

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

8. UNIX for Advanced & Expert Users

How to unzip a .zip file when

there is no unzip package present. (2 Replies)
Discussion started by: yogesh_powar
2 Replies

9. Shell Programming and Scripting

perl ftp check file exists

I have a perl script that ftp's to an NT server, checks if the file is growing, gets the file, does some more size checking after the get on the unix box. My question, is there a good way to check if the file exists on the NT when I know the exact file to check for? I thought about doing an "ls... (2 Replies)
Discussion started by: methos
2 Replies

10. UNIX for Dummies Questions & Answers

unzip a zip file

hello everyone, i have a dumb question...how do i unzip a zip file?? it has an .zip extension... thanks xNYx (4 Replies)
Discussion started by: xNYx
4 Replies
Login or Register to Ask a Question