Folder Iterator

I am trying to delete files from a directory recursively. Using a Folder Iterator I set my Starting Folder to C:\aaa, Iterator Variable to CurrentPath, and check both Recurse and Include Path.

I add a Delete Files to the iterator with the File Spec %CurrentPath%\*.*

At run time it deletes all files in C:\aaa\bbb and C:\aaa\bbb\ccc BUT does NOT remove the files in  C:\aaa

It is skipping the Starting Folder! Is this normal?

Thanks

Bob

Hi Bob,

Thanks for posting. You are correct - the folder iterator does not do an iteration for the “parent” folder, just all of the folders beneath it.

If you need to delete everything, then you may want to try using the Delete Directory action with the “delete tree” option enabled.

If you only want to delete files but leave the directory structure, you may want to try using “FileSet Define” to define a FileSet which recursively includes all the files, and then do a FileSet Delete to remove them.

Hth.

Regards,

Angus