Hi all
I have seen a few posts regarding the deletion of "old" input filers then running the workflow, or as a cleanup after the workflows have been run, but can't seem to locate solution for my requirements.
I need to be able to delete all files in a specific folder, older than 48 hours (new files are created every Monday and Thursday).
The only issue I can see is the folder name has both spaces and an ampersand ('&') [e.g. G:\Shared drives\AU Desktop Support National\Operational & Reporting\Departers\Input files], which is causing a 'parse' error when/if I use the formula tool
There are 10 files in the folder consisting of either ZIP or XLSX files, does not contain any subfolders and all files can be completely deleted.
The "Directory Tool" is recognising the directory structure correctly
Can anyone offer a suggestion as to fixing the parse error, so the files can be deleted ?
Solved! Go to Solution.
Please share what is the error you are getting and how the formula tool was configured.
Hi @gabrielvilella
Apologies for the omission
here is a screenshot of the test workflow, plus the error message
hi @StephenT
Based on the error message, you probably have your quotes mixed up in the formula tool. Can you share the formula?
Hi @StephenT
Do you actually have a field in your workflow called 'G:\Shared...'? The brackets indicate a field that Alteryx should look for. The error is saying that the field doesn't exist.
Thanks @Luke_C
"G:\Shared drives\AU Desktop Support National\Operational & Reporting\Departers\Input files" is the directory, from the directory tool. It's not a file or field.
That means the formula should read as 'del /f ' +'"' + [FullPath] +'"' - that was totally my fault
When i now run the workflow it works up to that point, then fails when it outputs to the batch file, so thank you for your guidance
The other (hopefully small) issue i have is it appears that the workflow is truncating the files names/folders when exporting to the batch file, causing the batch file to fail.
Does anyone know how to stop the folders/files from being truncated ?
I have also attached the WorkFlow for reference.
Any guidance/.help would be immensely appreciated
Thanks @Luke_C
I never saw that function, or thought to look for it.
I'll test it later today, and mark it 'accepted as a solution' when it works.
Thanks again
I have a question on this, would it be possible to parameterize the directory path. So in this situation its just one folder, What if I need to dynamically pass in the parameter for input path to delete older files - with the help of maybe a configuration file that tells which folder to delete files from.
Is this possible