I have the following script to rename the files in a directory and add a 1,2,3, etc to the end of the file. I want the number to be in the format of filenamedate-1.tif, filenamedate-2.tif, etc. When I run the script, the first file adds a hyphen at the end of the filename with no number after it, such as filenamedate-.tif.

Is there a way to start with the -1 on the first file? If not, can I prevent the "-" from appearing at the end of the first filename?

Here's what I have so far:
 Code:
$folder = "U:\test\"
$dir = dirplus($folder,"/a-d /f tif")

$date = Trim(Join(Split(@DATE,'/'),'-'))

For Each $file In $dir
		 $file.Move($folder + "AND" + $date + "-" + $i + ".tif")
		? @SERROR
		$1 = 1
	
Next