Rename File with Modified Date - VisualCron - Forum

Community forum

DanTr
  •  DanTr
  • Paid support Topic Starter
2017-04-25T19:58:09Z
Hello,
We are stuck and in circle with the rename task and have not come up with a solution so I would like to ask the forum for assistance. We have a folder of files with different types and would like to add the modified date to the beginning of the file name. We created a user-defined variable for the file's modified date but could get only one file to change, then the rename task returned with exit code 77777, Illegal characters in path. Or all the files would disappeared after the job is complete. and now, nothing works.

old name: filename.pdf
newname: YYYYmmDD_filename.pdf

Thanks in advance for any assistance



DanTr
thordw
2017-04-26T07:12:32Z
Hi I think you're only option is to loop each file and extract modtime from the function {FILE(ModifiedTime|<File>|yyyy-MM-dd HH:mm:ss)}

And in the renaming task use the following, it should work (I think)
{PATH(GetDirectoryName|{LOOP(CurrentValueX)})}\{FILE(ModifiedTime|{LOOP(CurrentValueX)}|yyyy-MM-dd_HHmmss)}_{PATH(GetFileName|{LOOP(CurrentValueX)})}

Hope it helps

/Thord
Support
2017-04-26T19:46:46Z
I suggest downloading and installing this build: http://www.visualcron.co....aspx?g=posts&t=7249 

Then you can use this:

{FILE(ModifiedTime|{TASK(Active|SourceFolder)}\{NEWNAME()}|yyyyMMdd)}{NEWNAME()}

If you cannot upgrade you need to replace: {TASK(Active|SourceFolder)} with the folder name you use.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top