Skip to main content
Solved

How can i automate the deletion of a folder???

  • March 9, 2022
  • 5 replies
  • 823 views

ingalla
Contributor
Forum|alt.badge.img+10

I have a workspace which goes off to the www to download a file for processing further along the workbench. Once the task has completed how can i automate deleting all contents of the specified folder. I am aware of directory watch to do something when a folder is modified or deleted, but i just want to delete the contents.....

Best answer by geomancer

For me, TempPathnameCreator would be the way to go.

Start with a Creator, followed with a TempPathnameCreator, a HttpCaller to download your data (save as set in the TempPathnameCreator), and finally use a FeatureReader to actually import the data.

No need to worry about removing your download later.

TempFileCreator

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2940 replies
  • March 9, 2022

Different options:

  • SystemCaller and commandline like DEL or RM.
  • PythonCaller and Python.
  • FileCopyWriter, I have seen a post on the forums where someone used the FileCopyWriter to delete folders or files, not sure how.

 

As an alternative you can download your files to a temp folder created by the TempPathnameCreator. This is what I use if possible.


birgit
Influencer
Forum|alt.badge.img+21
  • Influencer
  • 131 replies
  • March 9, 2022

Maybe other people have some other ideas but I generally use or the SystemCaller to do some command line things or the PythonCaller with a script. I like the PythonCaller better because I find it easier to check for problems with the directory path I am using to clear of files.


david_r
Celebrity
  • 8394 replies
  • March 9, 2022

My personal "best practice" is to always use the temporary folder given by the TempPathnameCreator transformer. This folder is guaranteed to be unique every time and is automatically deleted by your OS once the workspace completes.


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 933 replies
  • Best Answer
  • March 9, 2022

For me, TempPathnameCreator would be the way to go.

Start with a Creator, followed with a TempPathnameCreator, a HttpCaller to download your data (save as set in the TempPathnameCreator), and finally use a FeatureReader to actually import the data.

No need to worry about removing your download later.

TempFileCreator


ingalla
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • 33 replies
  • March 9, 2022

For me, TempPathnameCreator would be the way to go.

Start with a Creator, followed with a TempPathnameCreator, a HttpCaller to download your data (save as set in the TempPathnameCreator), and finally use a FeatureReader to actually import the data.

No need to worry about removing your download later.

TempFileCreator

Thanks very much for all the suggestions, I will give it a go and certainly look at the TempPathnameCreator

Â