0

Hi Experts,

I'm newbie in Shell Srcipt Programming. I want to copy some binary files to remote server through ftp script. I got a script which is working fine like coping files to remote server. But I want to put some conditions in script like if the file already exists so should n't be copy to remote server and copy daily atleast 5 files to remote server. Where to put those conditions in script.

LOCALDIR=/backup/archive 

REMOTESERVER=192.0.0.132 

REMOTESERVER=/dump/archive 

LOGIN=admin 

PASSWORD=xyz 

FTPLOG='/tmp/ftplog' 

date >> $FTPLOG 

cd $LOCALDIR 

ftp -n $REMOTESERVER <<INPUT_END 

quote user $LOGIN 

quote pass $PASSWORD 

cd $REMOTEPATH 

prompt off 

mput *.* 

exit 

INPUT_END

Regs

Muhammed

Edited by Nick Evan: Added code-tags

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by griswolf
0

First: Please us the (CODE) button when you post. It is good in lots of ways, and a requirement when you post code at DaniWeb.

Second: You seem to be trying to build a baby source / revision control or backup system. Why reinvent this functionality when there are many excellent and free options available. http://en.wikipedia.org/wiki/Revision_Control_System#References.

If you really want to do this as a remote copy of your file system, consider rdist: http://www.magnicomp.com/rdist

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.