FTP - Put new files only

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tsspmkp
Posts: 2
Joined: 20 Jul 2009 10:16

FTP - Put new files only

#1 Post by tsspmkp » 20 Jul 2009 11:01

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

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 20 Jul 2009 11:17

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.

tsspmkp
Posts: 2
Joined: 20 Jul 2009 10:16

#3 Post by tsspmkp » 20 Jul 2009 12:04

actually, I do have control - but I am not unix fluent -

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

#4 Post by ghostmachine4 » 20 Jul 2009 17:47

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.

Post Reply