Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I wanted to delete the files from a remote folder and I used the tFTPDelete component. Here is the configuration for it:
Basically, I wanted to empty this folder but KEEP the folder still. Initially, I put "*" on filemask and the job failed, and below is the error code:
Exception in component tFTPDelete_3 (movefiles)
24: This request cannot be used to remove a directory
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
at com.jcraft.jsch.ChannelSftp.rm(ChannelSftp.java:1958)
Then I put a new filemask ( shown above), all the files match that pattern except one .zip file. I ran the job again and the files were deleted, only .zip was left in the folder.
BTW, both times the Target Type was "File".
I am thinking - does tFTPDelete not allow us to empty a folder if we choose "File" as Target Type?
JGM,
Thanks for your quick response, here is what I observed:
1.
Even though "Die on error" was unticked, the job still wouldn't run, it would just stop:
This request cannot be used to remove a directory
[statistics] disconnected
2. Only one component is needed to delete the files and directory:
My question still is : how to delete the files and still keep the folder on remote server? Is that possible?
I think I get the answer to my own question.
If I want to delete all the files from a folder but still keep the directory, I will need to use specific file mask(s) which would delete all the files, but the file mask shouldn't be "*".
For example, if I have below files in a folder, I should use file mask "Testfile_*" and "file_*" to delete all the files.
Testfile_001.xlsm
Testfile_002.xlsm
file_001.xlsm
file_002.xlsm
As long as specific file mask(s) is used to delete all the files, it doesn't matter Target Type is "File" or "Directory", it would only delete the files and always keep the directory.
Only the file mask "*" + Target Type "Directory" combination would delete the directory.
@Moe,yes you can use the data mask from the tFTPList.
tFTPList--Iterate-->tFTPDelete and use the global parameter from FTPList in FTPDelete.