Two Stars tpk
Two Stars

[resolved] Copy single unique file from different directories to other directory

Hi all,
As a part of my daily process i have to copy .tar.gz files from many directories to one location and later unzip them and process them, I am not able to find out how to Copy files from many directories to one location
For example, let us say that i have
C:/Test1 ----> Contains File1
C:/Test2 ----> Contains File2
C:/Test3 ----> Contains File3
Each directory contains .tar.gz files respectively, so now i want to copy the files from each directory and paste it in one location. I had done one job using tFileList and tFileCopy
tFileList_1 -------------> tFileCopy_1 ------------> tFileUnarchive_1
But this could copy only multiple files in one directory to another, but i want each file present in multiple directories at a single stretch.
Is it possible to perform the way i want? or Should i need to have 3 tFilelist_1 components and 3 tFileCopy_1 components in a single job and run them parallel?
And after i copy i use tFileUnarchive to unzip the copied files, while i run the job i am getting an error, i am not able to debug it, can any one of you help me to resolve this error.I attach the images of the error i get so that it would be helpful for your better understanding.
Thanks and Regards,
Pavan
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] Copy single unique file from different directories to other directory

Hi Paven
It should be like this.
int temp =((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"));
if(temp==1){
context.directory="C:/Test1"
}else if(temp==2){
context.directory="C:/Test2"
}else if(temp==3){
context.directory="C:/Test3"
}

They are directories. You can't use file path in tFileList.
Regards,
Pedro
5 REPLIES
Two Stars tpk
Two Stars

Re: [resolved] Copy single unique file from different directories to other directory

Hi all,
can any one help me with the situation below?Please i am in great need of how to accomplish the below mentioned job
Thanks and Regards,
Pavan
Hi all,
As a part of my daily process i have to copy .tar.gz files from many directories to one location and later unzip them and process them, I am not able to find out how to Copy files from many directories to one location
For example, let us say that i have
C:/Test1 ----> Contains File1
C:/Test2 ----> Contains File2
C:/Test3 ----> Contains File3
Each directory contains .tar.gz files respectively, so now i want to copy the files from each directory and paste it in one location. I had done one job using tFileList and tFileCopy
tFileList_1 -------------> tFileCopy_1 ------------> tFileUnarchive_1
But this could copy only multiple files in one directory to another, but i want each file present in multiple directories at a single stretch.
Is it possible to perform the way i want? or Should i need to have 3 tFilelist_1 components and 3 tFileCopy_1 components in a single job and run them parallel?
And after i copy i use tFileUnarchive to unzip the copied files, while i run the job i am getting an error, i am not able to debug it, can any one of you help me to resolve this error.I attach the images of the error i get so that it would be helpful for your better understanding.
Thanks and Regards,
Pavan
One Star

Re: [resolved] Copy single unique file from different directories to other directory

Hi Pavan
This is related to 23214.
Here is another workaround to use only one tFileList(Image 1).
Add a context variable in this job called context.directory.
Type context.directory in the "directory" textfield of tFileList.
Set tLoop to loop 3 times and code in tJava as follow.
int temp =((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"));
if(temp==1){
context.directory=.... //the path
}else if(temp==2){
context.directory=.... //the path
}else if(temp==3){
context.directory=.... //the path
}

Regards,
Pedro
Two Stars tpk
Two Stars

Re: [resolved] Copy single unique file from different directories to other directory

Hi Pedro,
I guess there is no luck working towards me, I had done my job the way you told but the job executes successfully but my purpose is not accomplished, the loop executes for three times and the value doesn't gets forwarded to the next component and hence the files are not copied, Please help me with a solution
I attach the images of my job and properties of each component
Thanks and Regards,
Pavan
One Star

Re: [resolved] Copy single unique file from different directories to other directory

Hi Paven
It should be like this.
int temp =((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"));
if(temp==1){
context.directory="C:/Test1"
}else if(temp==2){
context.directory="C:/Test2"
}else if(temp==3){
context.directory="C:/Test3"
}

They are directories. You can't use file path in tFileList.
Regards,
Pedro
Two Stars tpk
Two Stars

Re: [resolved] Copy single unique file from different directories to other directory

Hi Pedro,
Thank you very much! It's working
Thanks and Regards,
Pavan