Will
Will

Reputation: 35

Rename file so it includes the date

I am currently using file.rename and wish to include a dd.mm.yy at the very end of the new file name.

file.rename('x.xlsx','x DD.MM.YY.xls')

Upvotes: 0

Views: 90

Answers (1)

tushaR
tushaR

Reputation: 3116

fname = "x"
date=as.character.Date(format.Date(Sys.Date(),"%d.%m.%y"))
fmt=".xlsx"
newname=paste0(x,date,fmt)
file.rename("x.xlsx",newname)

Upvotes: 1

Related Questions