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
janhess,
I tried checking "includes subdirectories", but the problem with this solution is that, in my tFileCopy component i can't copy directories and files. Maybe, i can try to separate the copy of directories and files with two different tFileList and tFileCopy but actually, i don't know how to do this exactly (because, if i want to copy the directories first, files will be copied too, and if i copy files first, i'm not able to retrieve their former directory).
preatorien,
Put the following in your destination of your tFileCopy:
"DEST FOLDER LOCATION: What you put in your tFileCopy" + StringHandling.RIGHT(((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")),StringHandling.LEN(((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")))-StringHandling.LEN("E:\TestAsupprimerEnsuite\In"))+ "/" + ((String)globalMap.get("tFileList_1_CURRENT_FILE"))
This will do the following: Destination Folder + Subdirectory name + FileName.
Doing this will give you the same directory structure.
Thank you so much mpa, it works. It?s not a beautiful solution but it works.
I explain my job for those who are interested in. You can see a screenshot of the job in attachment.
tFileList_1 settings :
- Directory : ?E:/TestASupprimerEnsuite/In?
- FileListType : Directories
- FileMask : "AAA*"
Don't check the "includes subdirectories" setting.
tFileList_4 settings :
- Directory : ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
- FileListType : Files
No Filemask, Check "Includes subdirectories"
tFileCopy_1 settings :
- File Name : ((String)globalMap.get("tFileList_4_CURRENT_FILEPATH"))
- Destination directory : "E:/TestASupprimerEnsuite/Out/"+StringHandling.RIGHT(((String)globalMap.get("tFileList_4_CURRENT_FILEDIRECTORY")),(StringHandling.LEN(((String)globalMap.get("tFileList_4_CURRENT_FILEDIRECTORY")))-28))
28 is the length of the directory of tFileList_1, to do this in a beautiful way, you can declare it in context variable.
- Check "Remove source file", "Replace existing file" and "create the directory if it doesn't exist"
- don't check "Copy a directory"
The second part of the job with tFileList_2 and tFileDelete_1 is used to delete the directory (all files are already removed in the tFileCopy component).
tFileLis_2 settings : same as tFileList_1
tFileDelete_1 settings :
- Directory : ((String)globalMap.get("tFileList_2_CURRENT_FILEPATH"))
- Check "Delete Folder"
Thank you mpa.
preatorien,
I don't understand why there are 2 filelists for the copy part, but if it works it's ok I guess :-).
Can I ask you a question?
How did you upload that image, I have been some time on the forum now but never understood it! I always use
Regards
Would it be better to have the output base directory as a context variable - basedirectory and use len(context.basedirectory).
eg Destination directory : context.basedirectory+StringHandling.RIGHT(((String)globalMap.get("tFileList_4_CURRENT_FILEDIRECTORY")),(StringHandling.LEN(((String)globalMap.get("tFileList_4_CURRENT_FILEDIRECTORY")))-len(context.basedirectory)))
mpa,
I need two tFileList because all my files does not match the filemask. If i only use one of them, i lost some files. Anyway, it works. Thank you again.
To upload images, i use the "Image upload" option that is available under your message when you post a reply.
Regards
preatorien,
I had no idea hehe! After all this time, thanks a lot mate! Will be a lot easier for me to help people on the forums
Have a nice day,
Regards