Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Rename fileYMDHMS create date
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Debug(1) path="C:\Temp\" file="test.txt" fullfile=strcat(path,file) if fileexist(fullfile)==1 a=FileYMDHMS(fullfile) ;;;This will separate it into 3 separate parts; param1, param2, param3 Year=Itemextract(1, a, ":") Month=ItemExtract(2, a, ":") Day=ItemExtract(3, a, ":") ;;;Some days and months may only have one digit. To make sure they have two digits: If StrLen(month) == 1 then month="0%month%" If StrLen(day) == 1 then day= "0%day%" ;;;Get file extension of the file ext = FileExtension(fullfile) ;;;You need to concantenate the parts together. Datename=StrCat( path,month,day,year,".",ext) message("NEWNAME",datename) ;;;Rename the file Filerename(fullfile,datename) message("FileRename","SUCESSFUL") endif message("FileRename","FINISHED")
Article ID: W13756
Filename: Rename file with file creation date.txt
File Created: 1999:04:15:16:56:10
Last Updated: 1999:04:15:16:56:10