Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
//Get file path
String fileToCopy = input_row.fileToCopy;
//Replace back slashes to forward slashes - Windows
fileToCopy = fileToCopy.replace('\\', '/');
//Set fileToCopy value
output_row.fileToCopy = fileToCopy;
//Replace the start of the path to change it to the new start or root
String outputPath = fileToCopy.toUpperCase().replaceFirst("C:/TEST", "E:/TEST/NEW_LOCATION");
//Remove the file name from the path so that only the path is left
outputPath = outputPath.substring(0, outputPath.lastIndexOf("/"));
//Output the new file path
output_row.outputFilePath = outputPath;
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
//Get file path
String fileToCopy = input_row.fileToCopy;
//Replace back slashes to forward slashes - Windows
fileToCopy = fileToCopy.replace('\\', '/');
//Set fileToCopy value
output_row.fileToCopy = fileToCopy;
//Replace the start of the path to change it to the new start or root
String outputPath = fileToCopy.toUpperCase().replaceFirst("C:/TEST", "E:/TEST/NEW_LOCATION");
//Remove the file name from the path so that only the path is left
outputPath = outputPath.substring(0, outputPath.lastIndexOf("/"));
//Output the new file path
output_row.outputFilePath = outputPath;
Hi I used the above method to copy files from source to target. however files does not copied to destination folder. in tFileCopy i put destination directory as "outputFilePath" and filename as fileToCopy
please find my source and destination path
source D:/Documents/SourceDir/Important tables.docx
destination: D:/DESTDIR
I used same tjava code as given.
also I tried using context variable for destination directory in context file.
and kept context.tgtfilepath as destination directory
context file contains tgtfilepath=D:/DestDir
It copies the all files into destination folder. however it does not create subfolder at destination as per my source folder. Please help
in my source i have files like...
source files:
D:/Documents/SourceDir/Important tables.docx
D:/Documents/SourceDir/Other Files/File1.docx
D:/Documents/SourceDir/VPN Connection/File2.docx
aslo i need to check no. of source files and no of target files are same or not? how can i achieve this. please help
Randepp
It sounds like you may have been confused by my description. Can you give a screenshot of your job and of your tFileCopy configuration. I believe that maybe you have got the wrong values there.
Hi
Please find my tfilecopy settings.
Job executes but does not copy files/ folders from source directory to destination. also i need to copy all subfolders and files inside it to destination folder as it has structured in source (folders / subfolders / files)
If I used copy a directory option from tfilecopy(above), it works as I required however it copies source directory into destination directory. I need all files/subfolders(files) from source to destination directory with files/subfolders(files) in it.
Randeep
You've not set the columns correctly.
"File Name" should be.....
row2.fileToCopy
"Destination directory" should be....
row2.outputFilePath
This is assuming that you have configured the column in the tJavaFlex and used the same code as me
Hi,
7 years later, I am dealing with the same issue.
However, I have tried to implement the solution, but I do have the following issues:
I am using TALEND STUDIO V8.
fileToCopy and outputFilePath need to be configured in the schema of your tJavaRow component. If you have done this, then they will be available in the next component by using the row name before the column names. So, if your row is "row2" (as in the example above), they will be....
row2.fileToCopy
...and....
row2.outputFilePath
added the job demo which works for your reference