On Wed, February 28, 2007 8:21 am, Larry Bradley wrote: > I've written a PHP program to "mirror" data on a local drive to a > remote > FTP server. It compares file mod times, and only uploads files that > are > newer. Works like a charm. Except --- Did you consider just using rsync?... > To examine the remote directories, I use ftp_rawlist() to get a > directory > listing which I parse. However, the file modification time does not > have a > year, and does not show the seconds. I get around this by "assuming" > the > year is the current one, and then compare the file times of the local > and > remote files ignoring local file seconds. If they are different, I use > ftp_mdtm() to get the real remote time, and then do my compare. This > slows > things down a bit, as I have to go to the FTP server one more time. If the minutes are different, why would you bother to check the seconds?... > Any thoughts on how to get around this? > Is there a way to get a better > directory listing? I've seen some FTP servers that response to 'ls -als' with about what you'd expect from the shell. How they do it, I dunno, but I like it. > Second and more serious problem is that when I FTP the file to the > server, > the file mod time gets set to the current (file-creation) time. The > same > thing happens in a local-to-local file copy using copy(), but I can > use > touch() to update the mod time. rsync would fix this. You could also look at scp which allows you to specify that you want to maintain file attributes. > Any thoughts on how I might get the remote FTP server to do the > equivalent > of touch()? Actually, I should think you'd want to convince the server to "know" when the file was REALLY created/modifed based on the local file, not force the local file to look different just to accomodate the FTP server. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php