Skip to main content

Here’s the process I’m trying to implement:
I have a scheduled job that backs up a SQL database weekly. I’m using FME form/desktop to drop that .bak file into an FTP. I want the file I upload to have a dynamic date (date when the job runs and drops the file). I’m not sure how to go about this step. 

 

Personally I would prefer to have the process creating the backup naming it with a datestamp in the filename.

But it is also possible to rename the file before uploading it to the FTP. When I need to rename files I use a SystemCaller and a DOS command.

  • Creator to initiate process.
  • FeatureReader (Directory and File Pathnames) to look in the folder for the .bak file.
    • Under Parameters, set Retrieve file properties to Yes to get the path_created_date attribute.
  • AttributeCreator
    • create _filename_new using @Left(@Value(path_created_date),8).bak, this creates a filename like 20240528.bak
    • create _path_windows_new using @ReplaceString(@Value(path_windows),@Value(path_filename),@Value(path_filename_new)),
  • SystemCaller to rename the file
    • rename "@Value(path_windows)" @Value(_filename_new)
    • set ExitCodeAttribute.
  • Tester to check is ExitCodeAttribute = 0.
  • FTPCaller to upload the renamed file.
    • _path_windows_new

An alternative is to use the FeatureWriter (FileCopy) to rename the file, but must find the SystemCaller easier to work with.


Reply