Overwritten file is not seen by Monitor Folder

Questions and answers on how to get the most out of FFAStrans
Post Reply
lbruins
Posts: 2
Joined: Tue Oct 02, 2018 3:16 pm

Overwritten file is not seen by Monitor Folder

Post by lbruins »

Hello,

I have an XML that gets updated every hour that needs to be copied to another directory.
Often, the content is identical so only file date is changed.
So I start my workflow with a "monitor folder" processor, and this works fine the first time.
But when I overwrite the source XML with an identical or changed content, FFAStrans doesn't see it is updated.
It only works when I delete the source file, and then write the file again (with the same filename).

Question: can FFAStrans monitor file date (change/create) and/or filesize to see that the file is updated and needs to be copied to the destination?

Thanks a lot!
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Overwritten file is not seen by Monitor Folder

Post by momocampo »

Hello Ibruins,
Well, I think you can do like that :
Monitor folder-delivery folder-command executor
So, check if the "forget missing file is checked" in your folder monitor. Then, check you have checked "overwrite" in delivery node. At last, add a command executor node(just after delivery node) which delete your source file after delivery.
First time your xml will be processed, delivered and deleted. When you put again your xml, it will be processed, delivered(overwritten) and deleted again, etc.
It could be good, hope I understand well your demand.

Cheers.

Benjamin
lbruins
Posts: 2
Joined: Tue Oct 02, 2018 3:16 pm

Re: Overwritten file is not seen by Monitor Folder

Post by lbruins »

Hello Benjamin,

Thanks for your reply. There is one thing I didn't mention in my original question: this XML must always exist on both locations.
To be more precise: I have an application that (over)writes every hour an XML file to a path like: /production/filename.xml
Most of the times, this file is identical (although with an updated creation date), sometimes it's content is updated.
I need this file to be copied to /test/filename.xml
Both files need to exist at all times, because it is used by another application.

So: can FFAStrans copy a file, when it is not new but only overwritten?
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Overwritten file is not seen by Monitor Folder

Post by momocampo »

Hello Ibruins,
So ok, in that case you have to add a command executor for clear the cache record.
Add a command executor node after your delivery and put in this command

Code: Select all

%comspec% /c "if exist "%s_cache_record%" del /f /q  "%s_cache_record%""
.
Now, after your delivery, the cache of FFASTRANS is cleared and the copy begins again and again etc...You have a loop.
To avoid too many loop, in properties workflow menu, set a big sleep timer for ex : 1800 sec (30 min) or more.
Now, each 30 minutes your file will be copied (same file or not).
Unfortunately, if your file is updated 5 minutes after the ffastrans sleep timer, you must wait 25 minutes to have your updated file in delivery folder...

I don't know how you can do other way...

Cheers.

Benjamin
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Overwritten file is not seen by Monitor Folder

Post by admin »

Hi Ibruins, thank you for using FFAStrans and welcome to the forum! :-)

Benjamin gave you some good clues and I would like to expand upon them a bit. Like Benjamin wrote, use the "Command executor" node to delete the monitor record. You can set a lower loop if you want, like 15-30 seconds. FFAStrans will never see changes in realtime anyway so some seconds is needed wether you like it or not. Then, you can use the $read function on both the monitored file and the destination file and compare them both using the "Conditional"-node, like this:
2018-10-07.png
2018-10-07.png (19 KiB) Viewed 11491 times

Now you connect to it the "Folder"-delivery node. Also, connect to it the "Command executor" for removing the monitor record and set to execute on both (error and success). This should keep your xml updated with some seconds delay.

Hope this helps.

-steinar
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Overwritten file is not seen by Monitor Folder

Post by momocampo »

Hi Steinar,

Ouuuhhh I really like your method, really clever :)
In similar way, is it possible to use conditional to compare modified date of source file and destination file? Or created date?
Anyway, always happy to learn new "tips" /D

Thanks

B.
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Overwritten file is not seen by Monitor Folder

Post by admin »

Currently, FFAStrans has no inbuilt function to read file size and/or time created/modified/read of files other than the source input. But I think it would be a usefull addition for these scenarios. Thanks for your input! :-)

-steinar
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Overwritten file is not seen by Monitor Folder

Post by momocampo »

Yes, I think it will be very useful to have folder monitor with different possibilities.

B.
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Overwritten file is not seen by Monitor Folder

Post by admin »

Benjamin, Ibruins,

Take a look at this workflow: viewtopic.php?f=5&t=747#p2863
It's another method for continuously monitoring updated files. It might suit your needs.

-steinar
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Overwritten file is not seen by Monitor Folder

Post by momocampo »

Hello,

Yes Steinar, I have already took it and I'm studying it. Very useful again, thanks :D
Just one question : What is the ~ signification please? (just before "phone.txt" in generate text file node).
Cheers.

B.
Post Reply