Hi,
Are there any examples of removing files that match a regex or particular file extension?
i.e. remove all files, starting from the root and all sub-folders (recursively) that end with .cs
Hi,
Are there any examples of removing files that match a regex or particular file extension?
i.e. remove all files, starting from the root and all sub-folders (recursively) that end with .cs
Hi,
Please find the attached project file which uses a Fileset to recursively find all .cs files and then logs (or deletes) them.
Regards,
Paul.
Thanks!
So I basically do the same, but use the 'FileSet Delete Files' action to delete the files instead of logging.
Do you support regex at all?
Say I want to get all folders that have: .svn in my entire project.
Hi,
Filesets don’t support using regular expressions to match a path, you’ll need to use a File Iterator with a filespec of . and then use the If … Then action to check whether each file matches the regex.
> Say I want to get all folders that have: .svn in my entire project.
You don’t need a regex for this, you can just use a FileSet with the mask *.svn and check ‘Directories Only’.
Regards,
Paul.
Hi,
My mistake, filesets do support using regular expressions. You need to set the include pattern as ., then on the Filters tab add a ‘Path Contains’ filter and enable the Use Regular Expression option.
Regards,
Paul.