Answers for "File Copy - DELETE" https://knowledge.亚搏在线safe.com/questions/2948/file-copy-delete.html The latest answers for the question "File Copy - DELETE" Answer by sigtill https://knowledge.safe.com/answers/105683/view.html

The most recent (and best solution) is to overwrite the 3 parameters: and set filecopy_dest_filename = nul (with one l, not 2 ll).


Tue, 14 Jan 2020 07:30:35 GMT sigtill
Answer by sigtill https://knowledge.safe.com/answers/100347/view.html

UPDATE: 2020:

This solution seems to be easier than the previous:

Replace the three variables needed (filecopy_XXX, XXX XXX) and the dest_filename to nul (with one l, not two ll). And make sure the FeatureWriter is set to MOVE



Tue, 15 Oct 2019 06:28:55 GMT sigtill
Answer by mark2atsafe https://knowledge.safe.com/answers/32869/view.html

You could use FileCopy and move the file to the null folder. \dev\null on Linux I think. There is a Windows equivalent, but I can't recall it off hand.

Fri, 26 Aug 2016 16:13:30 GMT mark2atsafe
Answer by takashi https://knowledge.safe.com/answers/32842/view.html

Hi @kam, the "os.rmdir(path)" method removes an empty folder; the "os.removedirs(path)" method removes a folder and its subfolders recursively if they all are empty; the "shutil.rmtree(path)" method removes a folder and all files and subfolders belonging to the specified folder. See the Python documentation to learn more.

Fri, 26 Aug 2016 02:42:21 GMT takashi
Answer by itay https://knowledge.safe.com/answers/32819/view.html

@kam you could just use a system caller and an old fashion dos command for that

Thu, 25 Aug 2016 15:15:05 GMT itay
Answer by takashi https://knowledge.safe.com/answers/5641/view.html Hi Sig,

I don't think it's possible, but it's easy to delete a file with a script. Assuming that an attribute called "filepath" stores the file path that should be deleted,
-----
# Example for PythonCaller
import os
def removeFile(feature):
file = feature.getAttribute('filepath')
if os.path.exists(file):
os.remove(file)
-----
# Example for TclCaller
proc delFile {} {
file delete [FME_GetAttribute "filepath"]
}
-----

Takashi
Tue, 19 May 2015 09:31:33 GMT takashi