Page 1 of 1

FTP - Put new files only

Posted: 20 Jul 2009 11:01
by tsspmkp
Ok,

This is beyond my scripting skills - from a windows network I connect to a unix box, I then put files on the unix box. All is fine however, the pdf file are quite large and do not change often, so the *.pdf call is not very efficient. I would like transfer only the new pdf files in the pdf directory. The other directories are just fine.

Can someone please help? Ill buy you a burger...


----------------------------------------------------
account
password
prompt ;toggle confirmation prompting to off


cd /filepathwhereallthepdssare/ ;change to desired remote directory

ascii

mput \\filepath\Web\*.html ; this is fine - small overhead

bin

mput \\filepath\*.pdf ;this is where there are just too many files to copy.

bye ;quit the FTP program

Posted: 20 Jul 2009 11:17
by avery_larry
You'll probably be MUCH better off doing this some way other than ftp. rsync would work nicely for this. If you can use CIFS or NFS or something that allows you to map a drive then this would be easy.

If you don't have control of the UNIX box, then maybe someone else can help you.

Posted: 20 Jul 2009 12:04
by tsspmkp
actually, I do have control - but I am not unix fluent -

Posted: 20 Jul 2009 17:47
by ghostmachine4
you can download [url "http://gnuwin32.sourceforge.net/packages/findutils.htm"]findutils from GNU[/url], then use the find command.
first you create a dummy file, say we call it dummy.txt. then issue this command

Code: Select all

for .... ( find_gnu.exe /localpath -type f -name "*.pdf" -newer dummy.txt ) do (
  rem do your ftp
)


the find command will find the pdf files that are newer than the dummy.txt file. this way you get the newest pdf in that directory. using for loop, which i am sure you know how to do already since you are a windows guy, put each file into destination unix server.