I have the following folder hierarchy :
D
D1
D1doc1.txt
D1doc2.otherext
Readme.txt
D2
D2doc1.txt
othertext.txt
Using Camel file component, I would like to send the repertory D1 and its content to another endpoint. So far I manage to send file independently or a whole content of a repertory, but I don't know how to send with the prvious structure the repertory D1 and its content (not just the content)
To send all the content of D1, i am writing :
from("file://D/D1/?noop=true&recursive=true").to(.....)
and it sends everything inside D1 correctly. Now to send D1 as a full directory with the contents, I tried :
from("file://D/?fileName=D1&noop=true&recursive=true").to(.....)
of course not working as camel file is apparently designed to work for file only and not directories like I saw on this link :
http://grokbase.com/t/camel/users/1485bjq5zr/polling-a-directory-for-inner-directories
However, it looks annoying and strange to me as I have to make a hack changing the previous hierarchy into :
D
D1
D1
D1doc1.txt
D1doc2.otherext
Readme.txt
D2
D2
D2doc1.txt
othertext.txt
so that when I use :
from("file://D/D1/?noop=true&recursive=true").to(.....)
it finally does what I want sending the directory as well.
Is there really not a cleaner way to do this ? If no, what is the reason behind ?
Use recursive to tell Camel to travel down sub directories. And you can use the min/max depth options to control from and how far you go down.
This is the clean solution using the correct options for what they are intended.
For example on unix the find command also has minx/max depth options and its the similar concept in the Camel file component.
More details at: http://camel.apache.org/file2
And if you do not want to build the directory structured on the 'other side' you can use the flattern option.
It's a kinda old thread but I'm sure it will help someone
from("file:D:\\INPUTFOLDER?noop=false&recursive=true&maxDepth=NUMBEROFSUBDIR").process(new MyProcessor()).to("file:D:\\OUTPUTFOLDER");
in here NUMBEROFSUBDIR.. will be +1 from the main
directory(INPUTFOLDER) and it won't copy the folder unless you have
file present in it, as it supports FTP.
Related
I am new in lua and gmod coding. I have already coded successfully a HUD's addons but i am stuck in another.
I want to create a new entity, and after reading lots of tutorial, i manage to do it but in game, the word ERROR appears in red when spawning, not the model. The server and the client are located on the same PC, for debugging considerations. I try to put mdl files on several folders without aby change.
I put mdl file in
addons/models/model.mdl
I think the client doesn't find the model file : do i need a workshop content even for testing ? Where do i put the files ?
Thanks.
I got it. When reusing existing MDL file, i must keep the original path for files.
That is, when opening mdl file, a path is writing at the begining. This path must be the same in the models subfolder of the addons (path and filename).
Iam trying to automate the testing of a java bundle,Which will process once a file is dropped in a particular folder.
can we drop a file to a folder location automatically using camel,or at a set period of time(not intervals)?
is this possible purely by camel or should we incorporate other frameworks?
sure, you can use the camel-file component to produce (create files somewhere) and consume (read/process files from somewhere) and optionally control the initial/polling delays easily with attributes...
here is a simple example of consuming->processing->producing
from("file://inputdir").process(<dosomething>).to("file://outputdir")
alternatively, you could periodically produce a file and drop it somewhere
from("timer://foo?fixedRate=true&period=60000").process(<createFileContent>").to("file://inputdir");
Although camel could do this by creating a timer endpoint, then setting the file content and writing to a file endpoint, my answer would be to simply use a bash script. No camel needed here.
Pseudo bash script:
while [ true ]
do
cp filefrom fileto
pauze 10s
done
I have values in file:
en-us, de-de, es-es, cs-cz, fr-fr, it-it, ja-jp, ko-kr, pl-pl, pt-br, ru-ru, tr-tr, zh-cn, zh-tw.
how can I get this values for one request?
I want to create a query that takes the value of these in turn and writes the variable
This scenario can be achieved using Jmeter component "CSV Data Set Config"
Please refer to below mentioned link:
Jmeter CSV Data Set Config
Hope this will help
Can't comment, not enough karma. In response to above questions your path is probably wrong. If you use a debug sampler to show what path the CSV reader is taking I think you will find it is looking at something like C:/Jmeter/C:/path/to/CSV/file.
Another option for completing this is to use inline CSVRead. In your HTTP request use code like this -
${__CSVRead(etc/filters.csv,0)}${__CSVRead(etc/filters.csv,next)}
etc/filters is the RELATIVE path from Jmeters active running directory. In my case this evaluates to
C:/git/JmeterScripts/etc/filters.csv
In either case, I am sure your problem is that Jmeters active running directory is not what you think it is. I have had this problem several times with the same error.
Consider a scenario like this
Root
|-----a
|-----b (current folder)
|-----c
|-----etc...
The current folder is b
We need to find all folders on the same level as b.
In other words, What's the best method to get 'a' and 'c' ?
System independent:
Store your current folder in some scratch variable.
cd upwards, so that, in your example, you are in the root folder
List all the folders there. This should give you a, b, c, d...
Put that list in some suitable data structure.
remove the folder you stored in the first step from said data structure (since you only require the siblings, not the starting folder itself).
I would follow steps similar to #jstarek, but I would drop the second one.
Get the full path to folder b, strip out folder b from the path, list the directories in that path, and exclude folder b from the resulting set.
If you want information more specific to a programming language, please cite which one you are using. You mentioned WinForms so I would guess it's going to be .Net? If so, the .Net framework already has classes designed to complete this task.
EDIT:
If you're using .Net take a look at the DirectoryInfo class. It has a GetDirectories method that allows you to list the directories underneath a given directory very easily. It also has overloads for searching etc.
When I have used this in the past, exceptions can be thrown if the user running the program does not have permissions on the folder in question.
Here is a link to a sample of the DirectoryInfo GetDirectory method: http://msdn.microsoft.com/en-us/library/s7xk2b58.aspx#Y798
I am using the Drupal 7 Migrate module to create a series of nodes from JPG and EPS files. I can get them to import just fine. But I notice that when I am done importing them if I look at the nodes it creates, none of the attached filefield and thumbnail files contain filename information.
Upon inspecting the file_managed table I see that both the filename and filemime fields are empty for ONLY the files that I attached via the migrate module. This also creates an issue with downloading the files.
Now I think the problem has to do with the fact that I am using "file_link" instead of "file_copy" as the file operation I specify. The problem is I am importing around 2TB (thats Terabytes) of image files. We had to put in a special request with Rackspace just to get access to that much disk space on our server. So I can't go around copying from one directory to the next because of space issues. So "file_link" seems like the obvious choice.
Now you probably want to see how I am doing this exactly, so here is the code snippet:
$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);
As you can see I am specifying no base path (just like the beer.inc example file does). I have set file_link, the language, and the source fields for the description, title, and alt.
It is able to generate thumbnails from the JPGs. But still missing those columns of data in the db table. I traced through the functions the best I could but I don't see what is causing this. I tried running the uri in the table through the functions that generate the filename and the filemime and they output just fine. It is like something is removing just those segments of data.
Does anyone have any idea what this could be? I am using the Drupal 7 Migrate module version 2.2. It is running on Drupal 7.8.
Thanks,
Patrick
Ok, so I have found the answer to yet another question of mine. This is actually an issue with the migrate module itself. The issue is documented here. I will be repealing this bounty (as soon as I figure out how).