Avatar of tdantona
tdantona
Flag for United States of America asked on

Want CFFTP to download all newer files from remote FTP server

Hi all,

I want to use a CF page to access a remote FTP server and download all NEWER files to a local directory on the CF Server. I am currently able to access the remote FTP Server and return a Directory Listing so the access portion is working.

Any suggestions as to the best approach to GET all NEWER files from the FTP Servers root directory as well as all sub-directories and save them to the same relative paths on the local CF server.

Thanks to all for your input,
Tom
Web Servers

Avatar of undefined
Last Comment
tdantona

8/22/2022 - Mon
usachrisk1983

Haven't done it myself, but I would use ACTION="LISTDIR" to get the LastModified property of each file, and compare that with what your "older" files date is to see the difference.  More info on CFFTP and ListDir here:

http://www.cfquickdocs.com/?getDoc=cfftp
tdantona

ASKER
Well, that's the tip of the ice burg. I currently perform the LISTDIR function and it returns good info but only for the root directory. I'm thinking there must be an established method to compare all of the files in all sub-directories and retrieve and overwrite all newer files. There will be a couple thousand to go through and perhaps a couple hundred sub directories.

Tom
usachrisk1983

There's no recursive function for CFFTP, you'll need to loop through and get directories and search those as well.  Someone may have already written one that does what you're looking for, but I couldn't find any results via google for you.  It might be faster to write it than to search for it ;)
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
dgrafx

in certain instances it can be fun and challenging to write an advanced directory crawl.
but in this case it seems that you should simply be using the "folder synchronization" tool in an FTP client.
I'm only familiar with a few, but what I use is CuteFTP Pro, if you need a recommendation.
The synchronization tool can go either way. Make local like remote or make remote like local.

good luck ...
tdantona

ASKER
That would work if I was at the machine. In this case, I want a remote SERVER to pull files from a remote workstation and copy all new files to the REMOTE SERVER, so no client can be used. I will somehow need to at least be able to create a text file with all of the directory and file information in it then use that to run the CFTP command to move through the list and download any updated files to the remote SERVER.

Guess I'm hoping there is code being shared or offered for purchase that will streamline this for me.

Still waiting. . .
ASKER CERTIFIED SOLUTION
dgrafx

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
tdantona

ASKER
Researching iDirectory Now, thanks.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
tdantona

ASKER
I worked with the developer "great guy" and he customized iDirectory as iDirectory Plus - check it out on their site (above)