CAN AE10 give each renamed file an iterative sequential number from 1 -9999?

Discussion created by Justin_Cookee_8784 on Jan 13, 2017
Latest reply on Jan 30, 2017 by Pete Wirfs
HI All.

I have never posted here before so apologies if this is the wrong area. 

I have a process in AE10 to archive and add a date and timestamp to each file that lands in a folder before onward transfer.

However, I am struggling to find within the Help F1 documentation how I can add a sequential file number to each file and for AE10 to know exactly what the last URN was to add the next one.   

Has anyone done or achieved this previously?  

This is my current Process code below.  Any advice would be welcomed....thanks
Justin Cookee

! Change each file within this folder with the date and time
ForEach ($file in $files){
   $filename = $file.FullName;
   $name = [io.path]::GetFileNameWithoutExtension($filename);
   $FileExtension = $filename.Split('.')[1];
   $date = Get-Date -format yyyyMMdd;
   Rename-Item $file "$($name)_$($date)_$($time).$($FileExtension)"
   Write-Output "$($name)_$($date)_$($time).$($FileExtension)"}