Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

[resolved] File sync

Hi I want to keep the files at two locations in sync with each other.The two file locations will be passed as the context variables.
e.g.
let one location is C:/source
and the other is C:/target
When my job runs for the first time it should first check the source folder and match them with the contents of the target folder. If there is a difference in the two locations the files need to be copied to the other location.Basically the two folders need to be in sync with each other. If there are new files in the target folder they need to be copied to the source and vice versa.

Any help on the above will be highly appreciated.
Thanks in Advance
Abhineet
Labels (2)
18 Replies
Anonymous
Not applicable

Hi
@Or3l: I use tJava to get the current file name and initialize variables, such as the target file path, which will be used on tFileExist.
Best regards
Shong.
_AnonymousUser
Specialist III
Specialist III
Author

Finally it worked that too without a tJava 0683p000009MACn.png
Thanks Guys!!
Regards,
Abhineet
_AnonymousUser
Specialist III
Specialist III
Author

Hi,
appologies to reopen the resolved item.
As a part of the same requirement i need to copy only those files which are created not more the a minute before.
I was thinking of using a tfileProperties along with the below flow

tFileList--iterate--tfileExist---runif---tfilecopy
|
|
iterate(order2)
|
tfileProperties
and give the condition in runIf , something like (systemTime - filemodifiedTime < 1).
please suggest if it is the correct approach or can be achieved in some other way.

Regards,
Abhineet
_AnonymousUser
Specialist III
Specialist III
Author

Hi,
appologies to reopen the resolved item.
As a part of the same requirement i need to copy only those files which are created not more the a minute before.
I was thinking of using a tfileProperties along with the below flow

tFileList--iterate--tfileExist---runif---tfilecopy
|
|
iterate(order2)
|
tfileProperties
and give the condition in runIf , something like (systemTime - filemodifiedTime < 1).
please suggest if it is the correct approach or can be achieved in some other way.

Also , if the above approach is correct how to achieve that.
Regards,
Abhineet
_AnonymousUser
Specialist III
Specialist III
Author

Hi Team,
Can somebody help me on that?
Regards,
Abhineet
Anonymous
Not applicable

Hi,
I think I would first get the file that have been created not more than a minute before, then check if there are already in the target folder and then copy them. So It would give sthing like this
tFileList--iterate---tFileProperties----runif----tfileexist---runif---tfilecopy
One thing toknow is that the mtime property is based on the datetime modification of the file, so it's not really the date of creation of the file.
Furthermore I don't know if you have already managed that but you should probably "tag" the files you have already synchronized (by adding something in their name for example). Unless your job will be quite long.
_AnonymousUser
Specialist III
Specialist III
Author

Hi,
I tried the above connection but it seems that the connection "tFileProperties----runif----tfileexist" is not feasible. It gives me a warning that tfileProperties must have an output attached.
Regards,
Abhineet
ytuzet
Creator
Creator

Hi,
put a tflowtoiterate between tfileproperties an the runif
Anonymous
Not applicable

Use tfilelist---iterate-->tFilecopy 
 in tfilecopy you can use 
filename ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
Replace Existing files checked