I want to make the first step of my program a cleanup action, so that it deletes all files in the directory before it starts on the rest of the program. So I made a fileset set for ., and then a Delete Files action for the fileset.
Sometimes it deletes the files, sometimes it doesn’t. See screenshot below, it’s failing on the rename step, because the file from the last run is still in the folder… which means the delete files at the beginning of my project didn’t work. Not long after taking this screenshot, it started working again and deletes the files every time I run it.
I’m going back and forth between the regular run button, and the step run button, could that be part of the problem? Though so far I’m not been able to reproduce the problem on demand.
Attachment unavailable
Oh I think I figured it out. I’m supposed to use the action Fileset Delete Files when deleting files from a fileset, not the Delete files action. Sounds obvious but I didn’t know the former action existed until I thought to look for it.
So I guess Delete Files is only when files are in a directory.
Hi Katie,
The property the script is using off the FileSet returns all the files the FileSet contains concatenated together. They are concatenated using the seperator listed in the FileSet define.
The Delete Files action however doesn’t take a list of files to delete. It requires a FileSpec which is the entry made into the FileSet definition. This could be reduced to a single call to Delete File(s) using the directory and FileSpec set in the FileSet definition.