Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Rename a File with the Current Month and Day Tacked On

Keywords:    rename filedate   file date

Question:

How do I rename a file and tack on the 3-4 digits of the current date, as in "FIL0723", "FIL0724", etc.?

Answer:

Here's a sample script to do that:

	a=TimeYmdHms()
	b=ItemExtract(2,a,":")
	c=ItemExtract(3,a,":")
	d=FileItemize("c:\temp\*.*")
	e=askitemlist("Pick a File", d,@tab, @sorted, @single)
	f=fileroot(e)
	g=fileextension(e)
	h=strsub(f,1,3)
	i=strcat(h,b,c)
	message("The File Name is:", i)

Article ID:   W13879
Filename:   Rename a File and Concatenate Current Date onto File.txt