Deleting subfolders in webmethods MFT

Hi All,

I have a subfolder containing *.tab files and wanted to delete the entire folder along with files which delete action in file operations is not supporting. Is there any way to delete subfolders in webMethods mft instead of doing it manually.

1 Like

Hi Deepalakshmi,

you can try to get the list of the content of the folder and delete it in a loop.
After that, when the folder is empty, you can delete the folder itself.
Do so recursively beginning with the subfolder, which do not have further subfolders.

Outline:

- List content of the current folder
- Loop over list
-- Is folder?
--- Yes: Invoke this service for the subfolder
--- No: Delete file
- Delete folder (should now be empty)

You can check the size (=length of the content list) before the loop and just loop over it, when the it is >0.
When it is 0 you can delete the empty folder directly.

Regards,
Holger

2 Likes

Hello Holger,

Thanks for responding back. Adding few more points to the thread,

Zipped folders contain tab files. I am unzipping the zipped file contents in scheduled event, renaming and moving only the tab file to target. After the tab files are moved to destination, is there any ways to delete these folders which remains empty and undeleted in our local file path