Move sub directory to different directory using camel - apache-camel

How can I move sub directory containing files to different directory using apache camel.
for example
/home/camel/inbox/tenant/aws/*.txt to /home/camel/processed/tenant/aws/*.txt

You can do something like this:
UPDATED:
from("file:///home/camel/inbox/?recursive=true&delete=true&sortBy=file:name&include=(.*[.](txt|TXT)$)")
.to("file:///home/camel/processed/");

Related

Oneliner for SVN adding files inside unversioned subfolders

I have files that i want to add to svn that are inside a number of nested sub folders. All the subfolder tree is still unversioned.
Say i want to version file1 and file2 (but not file 3) inside subsubfolder and no other file inside subfolder (i.e. file0).
The current filesystem is as follows
trunk
|--subfolder
|--file0
|--subsubfolder
|--file1
|--file2
|--file3
Trunk is versioned, subfolder and subsubfolder are not versioned.
svn add /subfolder/subsubfolder/file1
gives
svn: warning: W155010: The node 'trunk/subfolder/subsubfolder' was not found.
svn: E200009: Could not add all targets because some targets don't exist
svn: E200009: Illegal target for the requested operation
I wonder if there is a quick, potentially one-liner, command to add those files instead of going through adding all the subfolders along the way (without adding their content) and then finally adding the files.
Use the --parents option. Here is an example:
svn add --parents /subfolder/subsubfolder/file1

Loop through a directory in Talend

I have a Directory with many sub-directories in it including one named as OLD. This OLD folder could also be inside any of the sub directories and contains archived files.
Root Directory A
SUB-DIRECTORY A
file1.txt
file2.txt
SUB-DIRECTORY B
file1.txt
file2.txt
OLD
SUB-DIRECTORY C
file1.txt
file2.txt
SUB-DIRECTORY D
file1.txt
OLD
SUB-SUB-DIRECTORY E
file7.txt
OLD
I need to create a job in Talend which shall look for all OLD folders (in main and in sub directory both) and delete the files from that folder. I can use tFilelist to and mask the files to be deleted. But unable to figure out how to configure the job to look for OLD folder in all sub directories and delete those files also.
What you need to do is in the tFileList put your main folder choose check box include sub directories and in the FileList type drop down list choose Directories. Your file mask should be "OLD" or if it is anything more "OLD".
Iterate and use the parameter ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
to capture your sub directories. Now you can use this folder path in a tFileDelete Which can also delete folders
follow below approach..
Add tFileList and configure to Travers over all the directories.
now use if conndition connection from tFileList
Add tJava and connect with iterator connection
Add tFileDelete after tJava and connect with IF condition.
Add below condition inside if condition.
((String)globalMap.get("tFileList_2_CURRENT_FILEPATH")).contains("OLD")
Now you will get the all files from all the directories above code will give pass to the files which has the "OLD" in there file path.
I have not tested but you can try it.

How to copy folder contents recursively in gradle zipTree?

copy {
from zipTree(rootDir.getPath() + "/archive.war")
include 'dirAbc/subdir/'
into 'src/dirEfg/subdir/'
includeEmptyDirs = false
}
I am trying to copy a folder and its contents (including subfolders and their contents), from a war file to a local location.
I have almost got what I want. The problem is the above leaves me with the following directory structure:
src/dirEfg/subdir/dirAbc/subdir/
instead of what I want and was expecting:
src/dirEfg/subdir/
What am I doing wrong?
It looks like this is currently not possible out of the box with the current implementation of zipTree in Gradle.
This enhancement is tracked in this ticket.
There are some workarounds you can try as suggested in this post in the Gradle forums.
One of them hints at extracting the zip tree and moving/renaming the contents.

How do I (recursively?) monitor contents of new directories using inotify?

Firstly, I want to start by using inotify to monitor a specific directory (the main directory) for files and sub-directories. If a new directory is added into this main directory, how would I make sure to monitor this sub-directory with inotify? How would I monitor a new directory within this sub-directory of the main directory?
I think adding it to the watch is easy by using the inotify_add_watch() function but I do not know how to get the correct relative path address of files and directories within sub-directories (to use for like Dropbox-like syncing in a different location while maintaining the correct directory tree, for example).
Well the fastest to implement (but not the fastest in reality) would be to:
Create the initial tree of directories by recursively exploring the children; An example in C/Linux can be found here:
http://www.lemoda.net/c/recursive-directory/
Add a watch for each subdirectory; When something has been modified or changed you can parse all children recursively and see the differences. Something similar was discussed here:
How to monitor a folder with all subfolders and files inside?
If this solution doesn't appeal to you, you might try to do a polling mechanism such that you must re-check the whole structure using a thread at a certain time interval.
Hope it helps!

c/windows : opening all .txt files within a directory

I want to know how to open all files with a specific extension like all .txt or .html files
within the same directory where my .exe file exsits and all its sub directories
the os is always windows..
thx in advance
UPDATE :
I wanna know how to :
1- list all files of specific extension within current directory.
2- list all sub directories.
Look at FindFirstFile() and FindNextFile() in the MSDN documentation
Start with http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx
Then look at http://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx

Resources