WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2000:12:26:14:12:06
Last Updated: 2000:12:26:14:12:06