SymmetricDS : File sync on same filename to different path - symmetricds

I have 2 files with same name but sync to different path at the target, but only 1 file get synced down at the target. I noticed in file_snapshot CRC32_CHECKSUM are the same for both filename. Is it the correct behavior ?

There was a fix for this that will be released in 3.8.28 but here is a link to the patch for 3.8.27. You will also need two routers and two file routers (which you may already have).
https://support.jumpmind.com/downloads/symmetricds/patches/3.8/patch-0003197.jar

Related

How to rename a file while using "move" in URL in apache camel

I have an URL like
url = "file:D:/inputFolder?move=D:/outputFolder". we are making this url dynamically.
I want to rename the file while moving, So I made it something like this
url = "file:D:/inputFolder?move=D:/outputFolder&fileName=abc.txt". But I think move and fileName do not work together, it is not renaming.
Is there any alternative to do it? Please remember I want with "move" only.
I cannot use .setHeader(..) also.
Thanks,
Hy,
as far as I understand you, your trying to move the file in one single uri.
That is not really how camel works.
The idea of camel is to have a "consumer" and a "producer", where the consumer loads data (e.g. your file) and the producer puts the data somewhere (e.g. save the file into a folder)
That being said, here is what worked for me with a java route:
from("file:/home/chris/temp/camel/in")
.to("file:/home/chris/temp/camel/out/?fileName=test.txt");
The from part configures the folder where camel looks for new files. A few notes on that:
The file component checks the folder each 0.5 sec for new files. This can be changed with the delay parameter
The option noop configures, if the file is being moved or copied. By default it is set to false, which means it is moved
In the to part you configure, where the file is supposed to be moved. Here you can use the fileName parameter to rename the file.
Be careful with this though, because setting an option in the uri directly does make it "static".
What I mean by that is, that the only way of changing the parameter is by completely reconfiguring the route or by restarting it, where neither is something you would want to do normally.
Note 1:
Moving all files that are put into one folder into the same file always overrides the previous file by default.
You could, for example, use the fileExists parameter to always just append the content of the file: fileExists=Append (See camel file docu for details)
Note 2:
There is an option in the file component to not "move" the file, but copy, rename and delete it, which sometimes is necessary, when you want to move it onto a different drive and a simple copy does not work.
Also see the docu for the camel file component for details on that.
Note 3:
You can have multiple to() statements in the same route to have the file moved to multiple locations. For example:
from("file:/home/chris/temp/camel/in")
.to("file:/home/chris/temp/camel/out/?fileName=test.txt")
.to("smtp:....");
Hope I could help you and answer you question.
Greets
Chris
Two possible ways to achieve your goal.
Use both "consumer" and "producer"
Using this way, you are free to control where and how your destination can be set and has great freedom to control filename with the use of a processor/bean.
from("file:D:/inputFolder")
.to("file:D:/outputFolder?fileName=abc.txt")
Use "consumer" only
Using this way, you are treating your work as source data control. This can be use when your file is going to move within same drive. The drawback is the filename rename pattern is limited (refer to camel file language)
from("file:D:/inputFolder?move=${file:parent}/../outputFolder/abc.txt")

Get the latest/recent file from FTP to local using Talend

I have to create a job in Talend which will connect to One FTP. The FTP is having various files for each day with same prefix but different timestamp appended(yyyymmddhhmmss) in the filename.
Example -
MyFile20151123142020.xml
MyFile20151123154748.xml
My requirement is to pick the latest or most recent file and copy to my local.
I understand that this could be achieved either by referring to the latest timestamp in the filename or referring to the last modified time. I thought of proceeding with the later and my job looks like below -
I dont know how to proceed further and how to use the latest mtime value to pick the most recent file.
After getting file properties, wen need to sort files by mtime or by basename then pick the first.
tSortRow : sort by mtime or basename if they have same pattern.
tSampleRow : "1" to get the first
tFTPGet : file mask = row3.basename (row3 the output flow of tSampleRow)

Conditionally ignore path from Subversion?

Is it possible to globally ignore a folder IF it is a child of a folder having a specific name? For example...
Exclude:
client/vendor
... or ...
app/vendor
But never exclude a "vendor" folder if it appears anywhere else?
I'm working on an AngularJS project and the "vendor" folder is common for client-side files. However, theoretically, it is possible that "vendor" may have another meaning in future projects and, if it does, it would generally be in another path.
The docs on this are a bit misleading (to me, anyway). It says to use the svn:ignore property but no examples anywhere show how to specify the conditional parent folder. They all appear to be manually ignoring a specific folder every time... via a command line.
Per the TortoiseSVN docs:
No Paths in Global Ignore List (Link here) You should not include
path information in your pattern. The pattern matching is intended to
be used against plain file names and folder names. If you want to
ignore all CVS folders, just add CVS to the ignore list. There is no
need to specify CVS */CVS as you did in earlier versions. If you want
to ignore all tmp folders when they exist within a prog folder but not
within a doc folder you should use the svn:ignore property instead.
There is no reliable way to achieve this using global ignore patterns.

How to process only the last file in a directory using Apache Camel's file component

I have a directory with files likes this:
inbox/
data.20130813T1921.json
data.20130818T0123.json
data.20130901T1342.json
I'm using Apache Camel 2.11 and on process start, I only want to process one file: the latest. The other files can actually be ignored. Alternatively, the older files can be deleted once a new file has been processed.
I'm configuring my component using the following, but it obviously doesn't do what I need:
file:inbox/?noop=true
noop does keep the last file, but also all other files. On startup, Camel processes all existing files, which is more than I need.
What is the best way to only process the latest file?
You can use the sorting and then sort by name, and possible need to reverse it so the latest is first / last. You can try it out to see which one you need. And then set maxMessagesPerPoll=1 to only pickup one file. And you need to set eagerMaxMessagesPerPoll=false to allow to sort before limiting the number of files.
You can find details at: http://camel.apache.org/file2. See the section Sorting using sortBy for the sorting.
An alternative would be to still using the sorting to ensure the latest file is last. Then you can use the aggregator EIP to aggregate all the files, and use org.apache.camel.processor.aggregate.UseLatestAggregationStrategy as the aggregation strategy to only keep the last (which would be the latest file). Then you can instruct the file endpoint to delete=true to delete the files when done. You would then also need to configure the aggregator to completionFromBatchConsumer=true.
The aggregator eip is documented here: http://camel.apache.org/aggregator2

Find trashed file location in GIO

The documentation says that all files moved to trash are stored normally in ~/.local/share/Trash/files. Are there an exception for files removed from removable media? Are they stored in drive_root/.Trash-xxx directory? Or is this behavior obsolete?
How do I find real file path of file in trash can? I have a list of GFileInfo obtained from g_file_enumerate_children for trash:/// uri. It's easy if all files are stored in one directory. But I'm afraid this could be different for removable drives.
From removeable media there are the .Trash-$(user_id) folders, so you will have to get all mounted disks as well as the home trashcan.
Under each mounted device (not being the home folder) will be a .Trash folder for each user ever having something deleted. So e.g. for my user foo which has ID 1000 (see /etc/passwd) you will have to look for .Trash-1000 folders.
This is AFAIK not obsolete, just think about the oposite, the file would have to be copied over to your home storage just to move it to trash...
For the second part, you probably better off asking that on the glib/gtk mailinglist.

Resources