Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tFileCopy and tFileDelete

Hello,
I try to copy a whole directory (or more) and delete it after.
To do this, i use a tFileCopy component and a tFileDelete component. The problem is when i want to do this on large file (>150Mo) it doesn?t delete every file in the directory.
I think that the problem comes from the tFileCopy. It doesn?t close the file.
Have you any suggestion ?
Regards
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I try this :
context.output+((String)globalMap.get("tFileList_4_CURRENT_FILEDIRECTORY")).substring(context.input.length())
context.output = "E:/TestASupprimerEnsuite/Out"
context.input = "E:/TestASupprimerEnsuite/In"
It works fine.

View solution in original post

21 Replies
Anonymous
Not applicable
Author

preatorien,
Are you trying to copy files from your source folder to another folder and delete the files in the source folder after they are copied?
If so you can use the delete in tFileCopy by enabling "Remove Source File".
If not is the filemask correct for all the files in the folder? (in your tFileList2 component)
You can try running both steps seperately to look if that makes a difference but I don't think so when using OnSubJobok.

Regards
Anonymous
Not applicable
Author

Hi mpa,

Yes, i?m trying to copy files from source folder to another folder and delete those from the source folder after they are copied.
I can?t use "Remove Source File" actually because i copy the whole directory not just a file.
My tFileList_2 does the same iteration that the first one (with same Filemask). And, it works with little file (under 100Mo).
I think the problem comes from tFileCopy because it doesn?t close the file after the copy.
I?ve tried something with a tSleep, to see if i could delete manually the file after the tCopy and it doesn?t work, the file is locked until the end of the job. (tFileList --> tFileCopu --> tSleep try to delete files or folder manually, it doesn?t work for big file).
Thanks for your answer.
Anonymous
Not applicable
Author

preatorien,
Ok I didn't now there was an option "Copy a directory".
Have u tried running both steps seperately? By Disabling the Delete step and running the first part, when the job is complete run the 2nd step to delete the files by disabling the first two components. If this works it would mean that you are right about the locking part. If it doesn't work it's something else.
Regards
janhess
Creator II
Creator II

Your tFileList doesn't include subdirectories so you can check the remove source file in the tFileCopy.
Anonymous
Not applicable
Author

mpa --> When i run the both steps seperately, it works. So, yes, i think it's a locking problem, but i don't know how to do to go around this problem. At the moment, i've tried a lot of different solution but nothings work.
Hi janhess, i will try your solution, but, i think that, if i check "include subdirectories", my filemask doesn't work anymore. Actually, i got this problem in a bigger Job, and there is some other constraint.
Thank you.
Anonymous
Not applicable
Author

Do you have multiple directies? Or just one directory?
If it's one directory you can use file in your tFileList and tFileCopy instead of directory and do the "Remove Source File". If it's not I guess you can't do this option.
Maybe creating a second job for the second step helps. Then create a father job doing "CopyJob" -OnSubJobOk-> "DeleteJob".
janhess
Creator II
Creator II

I didn't suggest you check the subdirectories. I said that since it was unchecked you could check the Remove Source File in the tFileCopy.
Anonymous
Not applicable
Author

Sorry janhess, i haven't read your post correctly. So, if i understand, you say that, actually, i can check "remove source File" in the tFileCopy? I try to do this, but, since it's a directory and not a file, tFileCopy is not able to delete it (I got a NullPointerException).
I also try to copy and delete file by file (not the whole directory) and use the "remove source File" option. It works, but it doesn't do what i need.
mpa, i have multiple directory. i have something like this
AAA_date_time
|
---AAA_name.zip
---AAA_name
|
AAA_name.csv
And i can have multiple AAA_date_time directory. I tried to do this in to different job, i got the same problem. I think since the father job is running, the big file are locked, even if i do the copy in one child job and the delete in an other one. And i don't understand why.

Regards
janhess
Creator II
Creator II

Ah in that case have you tried checking the subdirectories box in tFileList? I think this should process everything at the file level.