GetFiles to set timestamp on local files - WeOnlyDo Discussion board

GetFiles to set timestamp on local files (General questions)

by VicPeters, Monday, February 13, 2006, 18:43 (6857 days ago)

I use the GetFiles method to download all the files from the FTP server to the local directory. When the files are downloaded, their timestamps don't match those on the server. I would like to make them match after download.

Is there an event that gets fired AFTER every file is copied? I want to use such an event to set the local file's timestamp to match the remote file.

(The loopitem event gets fired before the file download but not after the file is copied)

Re: GetFiles to set timestamp on local files

by wodSupport, Tuesday, February 14, 2006, 01:57 (6857 days ago) @ VicPeters

Yes, I see your point. We have two ideas here.

If we add new property for your timestamp, we could add new event for this too :)

Or..

You can use LoopItem to set filedate of *previous* file. You know LoopItem would fire. You would just have to keep timestamp value somewhere until next LoopItem fires. For last file, you would use LoopError or Done events.

Would that work?

Kreso

Re: GetFiles to set timestamp on local files

by VicPeters, Tuesday, February 14, 2006, 13:50 (6856 days ago) @ wodSupport

Your first option of a new timestamp property with an event *after* the file is copied will work. The event should provide at least these parameters: RemoteFile, LocalFile, Timestamp.

The second option of setting the timestamp of *previous* file during the LoopItem event will not work because I can not get file attributes of the remote file while GetFiles method is still active.

Even a better option would be to let wodFtpDLX automatically set the right timestamp on upload or download of a file.

Re: GetFiles to set timestamp on local files

by wodSupport, Tuesday, February 14, 2006, 14:51 (6856 days ago) @ VicPeters

In my option, I think we could property

PreserveTime

that could be used only with GetFiles and PutFiles, so that component internally sets time for files after the transfer.

Do you think this could resolve your problem?

Kreso

Re: GetFiles to set timestamp on local files

by VicPeters, Tuesday, February 14, 2006, 15:39 (6856 days ago) @ wodSupport

PreserveTime property will work fine. Thank you.

Also, if there is a way to see the remote file's timestamp during GetFiles processing it will allow us to skip files whose local and remote timestamps match.

Currently, there is no way to get the remote file's timestamp during the LoopItem event (while GetFiles method is busy)

Re: GetFiles to set timestamp on local files

by wodSupport, Tuesday, February 14, 2006, 16:17 (6856 days ago) @ VicPeters

Vic,

no, unfortunatelly you cannot. You can implement your own GetFiles for this.

Make two collections - collection of folders, and collection of files (containing full paths). Issue ListAttributes on main folder, and put all folders to folders collection, and all files to files collection. Now do this recursively for elements in folders collection as long as there are elements there.

When you empty folders collection, you will have collection of files with full paths you just need to grab.

While doing above, ListAttributes would give you all the details you need, you just need to use them somehow - i.e. only add to files collection those files whose timestamp matches your condition.

Would above idea help?

Kreso

Re: GetFiles to set timestamp on local files

by VicPeters, Tuesday, February 14, 2006, 23:33 (6856 days ago) @ wodSupport

You can implement your own GetFiles for this.

I will wait for the PreserveTime option instead. Thank you.

Re: GetFiles to set timestamp on local files

by wodSupport, Monday, February 20, 2006, 01:18 (6851 days ago) @ VicPeters

Vic,

we have started implementing this, but I'm a bit worried this will bring more problems to techsupport than I imagined. I will have to pospone this feature for a while.

Kreso

Re: GetFiles to set timestamp on local files

by Ahmed, Thursday, May 17, 2007, 00:56 (6400 days ago) @ wodSupport

Any update on how this is progressing? I would have thought the standard thing is to preserve the timestamps? This makes me feel that the GetFiles command is pretty much useless unless you want to create a basic FTP client application?

It would be very convenient to be able to skip or post delete files based on any of the following:

TimeStamp
Permisions on Remote Machine
Entire Content of File

But timestamp is the most important. I'm going to have to build an entire function to do what you guys already have done just to get the timestamp.

- Ahmed

Re: GetFiles to set timestamp on local files

by wodDamir, Thursday, May 17, 2007, 09:13 (6400 days ago) @ Ahmed

Hi Ahmed,

This feature was delayed, and never actually implemented. However, you could use the suggestion Kreso made in on of his previous posts?

I will check with Kreso if we will be implementing this, and inform you as soon as I know more.

Regards,
Damba

Re: GetFiles to set timestamp on local files

by wodSupport, Friday, May 18, 2007, 03:10 (6399 days ago) @ wodDamir

Ahmed,

this sounds like a good idea. We'll try to implement it by monday.

Kreso

Re: GetFiles to set timestamp on local files

by wodSupport, Sunday, May 20, 2007, 03:40 (6397 days ago) @ wodSupport

Ahmed,

I believe we have something. Can you please send email to techsupport@weonlydo.com and we'll send you wodFtpDLX with PreserveDates property for your tests.

Regards,
Kreso