Solved

Renaming File With No Extension

  • 22 May 2023
  • 1 reply
  • 137 views

Userlevel 1
Badge

I need to be able to change a filename of an outbound file to the following naming convention MOT599XXXX.CCYYMMDDHHMMSSNN using the current date and not adding a file extension. Any pointers on getting this done?

icon

Best answer by James B 26 May 2023, 18:34

View original

1 reply

Userlevel 6
Badge

You would want to rename the file before it is passed to whatever connector is being used for transport here, which you can do through a simple Script connector. 

 

<!-- reference original file contents -->
<arc:set attr="output.filepath" value="[filepath]" />
<!-- overwrite filename -->
<arc:set attr="output.filename" value="MOT599XXXX.[now('yyyyMMddHHmmssff')]" />
<!-- pass out file -->
<arc:push item="output" />

 

A few notes:

  • I’m assuming NN is fractions of a second. In Windows, this time format is ff - in Java it is SS
  • HH returns the hour in 24 hour format - hh is 12 hour

Reply