Simple Copy Command... How To Append Date

Hello,

I am trying to create a button with a simple copy command that copies a file 'test.txt' from one folder 'a' to another folder 'b', but I would like a file date appended to it, for example, can dopus rename the resulting file to 'test 20100823.txt' ?

this is all I have so far :slight_smile:

Copy C:_TMP\a\test.txt TO C:_TMP\B

Have a look here (second example):

Add the current date and time to a file's name

That was nice of you to find that link for me, I couldn't seem to come up with anything when I searched!

So - is the best way to copy a specific file from 1 location to another while appending the date to the new file name to use 2 commands like this? I suppose there's no way to do it in 1 command?

Copy C:_TMP\a\test.txt TO C:_TMP\b
Rename C:_TMP\b\test.txt TO="C:_TMP\b\test - {date|yyyy-MM-dd} {time|HH-mm-ss}.txt"

If you want the current date/time to be used then you can do it using a single line:

Copy "C:_TMP\a\test.txt" TO "C:_TMP\b" AS "test - {date|yyyy-MM-dd} {time|HH-mm-ss}.txt"

If you want the file's last-modified timestamp to be used instead of the current date/time, then you'd have to do that as a two-part thing (first copy the file, then rename it). Doing that is slightly different to what's been discussed so far so shout if you need help.

Thanks leo, that looks good for what I was trying to do!