Skip to main content
Solved

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


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

View original
Did this help you find an answer to your question?

5 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

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+16
  • Influencer
  • 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
  • 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+47
  • Evangelist
  • 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
  • March 9, 2022
geomancer wrote:

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

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings