Hi @asabhinavgreats,
I would give a shutdown-script a try. I wanted to copy the log-file from one location to another.
Therefore, I created two private parameters [logdatei]:
import time
# time.localtime() returns the current time as a Python object
# time.strftime gives a textual representation of the date
# %Y = Year, %m = month, %d = day, etc.
# FME_MacroValues['FME_MF_NAME'] ; siehe links die system parameters
#aus dem Workbenchnamen, der auch die Extension "fmw" enthält, wird nur der erste Teil (Element 0) weiterverwendet
workbenchname = FME_MacroValues['FME_MF_NAME'].split('.')[0]
logname = workbenchname+'_'+ time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime())+'.log'
return logname
and
[ziel], here I created a new destination folder ../YYYYMMDD:
# import fme and other modules
import fme,time,os
from os import path
# Filepath hardcoded to O:\\00_PYTHON
#startpfad = 'O:\\\\00_PYTHON'
startpfad = FME_MacroValues['_startpfad']
# time.localtime() returns the current time as a Python object
# time.strftime gives a textual representation of the date
# %Y = Year, %m = month, %d = day, etc.
textdate = time.strftime('%Y%m%d', time.localtime())
newdir = startpfad + '\\\\' + textdate
return newdir
The shutdownscript is pretty simple:
# import fme and other modules
import fme
import shutil
import os
file2move=FME_MacroValues['logdatei']
destination=FME_MacroValues['ziel']
shutil.move(file2move,destination)
Hope that helps!
Another option would be using the SystemCaller and use DOS commands to move or remove files.
Hi @asabhinavgreats,
What are you parameter settings in the File Copy Writer, in particular, is the File Operation=Move ?
This writer should be satisfactory to perform what you want to achieve without using a python script. If the Writer parameters are set up with the 'move' function rather than the default 'copy' but this still appears to only be copying over the files then please consider reaching out to our support team so we can investigate this issue further for you: https://www.safe.com/support/
I have used a Directory and File Pathnames Reader along with a FileCopy Writer with filename value as nul as a test. That worked for me. Thanks guys for your input.