
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
subfolder delete using tftp
I am trying to delete all the subfolder and file using tftpfiledelete but none of the option seems to be working and throws an error Below is the screenshot of the setup.I need to traverse all the sub directories and delete each file and folder under the parent directory. Any help would be appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
What the error are you getting when you are trying to delete all the sub-folder?
The tFTPDelete component uses 3rd party libraries (such as package com.enterprisedt.*) which doesn't allow deleting non-empty ftp directories.
However it's possible to achieve this with a routine which does this 'recursively'.
Best regards
Sabrina

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It gives me below exception
Exception in component tFTPDelete_1 (abc)
4: /temp/csv
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
at com.jcraft.jsch.ChannelSftp.rmdir(ChannelSftp.java:2149)
at test.tFTPDelete_1Process(test.java:1630)
at test.angfedpm.tFileList_4Process(test.java:14109)
at test.run(test.java:16809)
I agree if the folders are not empty it does not allow to delete the folder however in my case i have many such subfolder let us at runtime there would be sub-folder with name as timestamp eg.
csv
- 112345678
- a1.csv
- a2.csv
- 645755757
- b1.csv
- b2.csv
so i wont know how to iterate through all and delete the files under them before the deleting the folder
For the routine do you have sample to share
Appreciate your help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The Target Type will control what jsch method will be called ( ChannelSftp.rm() for files and ChannelSftp.rmdir() for directories ).
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.
For your use case, you will need to use specific file mask(s) which would delete all the files, but the file mask shouldn't be "*" and you can use the data mask from the tFTPList.
tFTPList--Iterate-->tFTPDelete and use the global parameter from FTPList in FTPDelete.
Let us know if it helps.
Best regards
Sabrina

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tFTPList--Iterate--tFTPDelete would not work in my case since i have many subfolder which i would need to iterate and delete all the files under how can i do this i haven't found a way yet to do this please let me know

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Would you mind giving us some example about your many sub-folder structure? Does the combination of tFTPDelete_1-->OnComponentOK-->tFTPDelete_2 helps?
Best regards
Sabrina

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my case number of sub folder is not fixed based on certain condition it may vary . can you share a screenshot for tFTPDelete_1-->OnComponentOK-->tFTPDelete_2 and helpme understand what will the firsttFTPDelete_1 will do and what will be the role of tFTPDelete_2
