Applying a Datetime stamp to filename

I’ve been a user of EasyMorph for a full five (5) days now. I’ve been reading through the training material I believed I could do this with parameters, but I am running into roadblocks. I am moving a file to an archive location and want to include the filename and a SHORTDATETIME stamp to mark the event.

Thanks for the assistance.

Hi @CVMorse and welcome to the Community!

I’m not sure I understood exactly your question but if you want to append the current date into file names here is an example:

file name with timestamp.morph (1.7 KB)

Thank you … I had just worked out a partial solution when I noticed your response. I am now attempting to include the time as well.

Example:

CustomerOrderImport_done_2018-Jun-26_15:55:20.csv

Check out this help article on date/time formatting.

Hi Dimitri

I’m a new EasyMorph user and I have a follow up question on this topic. Using your .morph file I can see that the internal table has the updated files names but I’m struggling to find a command which will actually update the file names for the entire folder, without having to manually specify each file name on export.

Example: lets say I have a folder with multiple files similar to your example
Name Date created
fileone.csv 08/16/2018 09:00
filetwo.csv 08/17/2018 15:00
filethree.csv 08/18/2018 13:00

I’m guessing there is a parameter or expression which could be used to rename the entire folder contents with filenames based on the current file name (without extension) + date/time stamp + file extension

fileone 08/16/2018 09:00.csv
filetwo 08/17/2018 15:00.csv
filethree 08/18/2018 13:00.csv

Can you help?

Thanks

Hi Mark,

there is no command to rename multiple files at once (yet), but you can use the “Iterate program” action with a dynamically composed Windows shell command to rename a file.

See the example below:

  • it generates a list of files in a folder specified by a parameter.
  • Then it calculates a new file name. Note that your example won’t work because slashes and colons are not allowed in a file name in Windows.
  • Then for each file, it executes Windows command ren "filename" "newname".

rename with timestamp.morph (2.5 KB)

Thanks Dmitry!

Here is an updated example that uses the “Rename list of files” command of the “File command” action.

rename with timestamp.morph (2.6 KB)