Two ways of doing this in FME:
1) Use the FileCopy writer, with the MOVE option
2) Use the SystemCaller transformer and a DOS command line, using the MOVE command
Hope this helps
If you want to move files, the file type is 'FileCopy', it does not relate to the type of files being moved, but the action itself
If you want to move files, the file type is 'FileCopy', it does not relate to the type of files being moved, but the action itself
Hi ebygomm, yep, I tried that. Doesn't appear to work - the file is neither moved nor copied. Not quite sure what I'm doing wrong - there's surely a simple soultion, right?
Hi ebygomm, yep, I tried that. Doesn't appear to work - the file is neither moved nor copied. Not quite sure what I'm doing wrong - there's surely a simple soultion, right?
Have you created the attributes?
- filecopy_source_dataset
- filecopy_dest_dataset
- filecopy_dest_filename
Simple example, use the path reader to get a file location, create attributes so that the file found is moved into a folder in the same location called csv
Have you created the attributes?
- filecopy_source_dataset
- filecopy_dest_dataset
- filecopy_dest_filename
Simple example, use the path reader to get a file location, create attributes so that the file found is moved into a folder in the same location called csv
Hey thanks ebygomm - I hadn't created those attributes - I didn't even know that was a required part of the process, thanks for that!
Nevertheless, I've tried the above and still can't quite seem to nut it out. For example, in Attribute Creator, when I attempt to enter the attribute values (eg @Value(path_windows)) the portion of text within the parentheses appears in red.
I've found a workaround for now, but thanks again!
Marty
Hey thanks ebygomm - I hadn't created those attributes - I didn't even know that was a required part of the process, thanks for that!
Nevertheless, I've tried the above and still can't quite seem to nut it out. For example, in Attribute Creator, when I attempt to enter the attribute values (eg @Value(path_windows)) the portion of text within the parentheses appears in red.
I've found a workaround for now, but thanks again!
Marty
Those attributes have to exist, which they do already if using a path reader to read file locations as in the example. If you have the file location of the excel file you want to move in a different attribute, you would need to use that instead. A FilenamePartExtractor may be useful here.
In the example above I'm taking a file "C:\\Users\\egomm\\File.xlsx" and moving it into a subfolder called csv in the same location
So
filecopy_source_dataset has an value of "C:\\Users\\egomm\\File.xlsx"
filecopy_dest_dataset has a value of "C:\\Users\\egomm\\csv"
fielcopy_dest_filename has a value of "File.xlsx"
Those attributes have to exist, which they do already if using a path reader to read file locations as in the example. If you have the file location of the excel file you want to move in a different attribute, you would need to use that instead. A FilenamePartExtractor may be useful here.
In the example above I'm taking a file "C:\\Users\\egomm\\File.xlsx" and moving it into a subfolder called csv in the same location
So
filecopy_source_dataset has an value of "C:\\Users\\egomm\\File.xlsx"
filecopy_dest_dataset has a value of "C:\\Users\\egomm\\csv"
fielcopy_dest_filename has a value of "File.xlsx"
Thanks Ebygomm.
Still can't quite get the correct reader to appear (what should I be typing on the canvas to bring up the correct reader? Neither 'path reader' or filepath reader' bring up a suitable reader. Best I can get is the 'Directory and filepath' reader, which I assume is the correct one.)
Anyways, I've found a workaround, but just wanted to say thanks again for the help. No need to waste more time dumbing things down for me unless you really want to.
Cheers,
Marty
Could even do it as a python startup script as part of the creating of the new excel file
To move file to a folder
import shutil
shutil.move(r"C:\Downloads\source.txt, r"C:\Downloads\DestinationFolder")
Also can move and rename if the full file destination is used
import shutil
shutil.move(r"C:\Downloads\source.txt, r"C:\Downloads\DestinationFolder\newname.txt")
With this method it is easy to add date information (YYYYMMDD_HHMMSS_source.txt)
import shutil
from datetime import datetime
#timestamp in YYYYMMDD_HHMMSS format
now = datetime.now().strftime("%Y%m%d_%H%M%S")
shutil.move(r"C:\Downloads\source.txt, r"C:\Downloads\DestinationFolder\{}_source.txt".format(now))