Hi Glenn, thank you very much for explaining that. I thought that there would be a simpler way. I inherited this script and it is basically supposed to look in a folder for files older than 30 days and move them to a specifically named folder by year which it creates as it goes along. Originally there were files to get from before 2000 hence the 1999 date, however this is no longer really needed.

SO what it is supposed to do is check a filelist txt file that is created from a dir for a date string to find files older than 30 days and move these to the relevant month/year folder..

I have placed the entire code below so you can see what its doing, my issue I think is the way that it is now formatting the mm/dd as dd/mm due to the new server this now runs on as being set with UK Regional settings whereas the old server was set with US regional settings, so I need it to be able to see the dates and create in the correct Regional setting.

The folder output is supposed to be servername\year\01-january etc..

 Code:
 ;	Variables used

;	$HasSpace		Used to determine if branch code < 3 digits
;	$Srvah			Local machine name
;	$FName			Current file
;	$SFile			Source file for copy
;	$DFile			Destination for copy
;	$LogText		Used for output to log file
;	$LogLoc			Central location of log file for current branch

;	Date variables

;	$yr $mn1 $dy $mn	No longer used (need to be cleaned up)
;	$sy			System date interim value
;	$SystemYear		Local current year
;	$SystemMonth		Local current month
;	$SystemDay		local current day
;	$SystemDays		Local days value.  Used in calc for file age.
;	$DateStamp		File date

;****** Setup
	
	debug off	; Allows batch debug
	break on	; Allows batch to be stopped
	
;******	Create date filename for logging
	$yr=left(@date,4)
	$mn1=right(@date,5)
	$mn=left($mn1,2)
	$dy=right($mn1,2)
	@crlf
	"Branch Journal File copy to G: Drive"
	@crlf
	"Do not close this window - It will close when the task is complete"

;******	Set date and create output file

	$SY = 1 + left(@date,4) - 1
	$SystemYear = 1 + right($SY,2) - 1
	$mn1 = 1 + right(@date,5) - 1
	$SystemMonth = 1 + left($mn1,2) - 1
	$SystemDay= 1 + right(@date,2) - 1
	$SystemDays=($SystemYear*365)+($SystemMonth*30.4167)+$SystemDay

;******************************************************************************
;************************************* 022 ************************************
;******************************************************************************
;******	Gets server name from system variable

	:GetServer
	$Srvah = "HO-022"
	
;****** Server Selected
	:SSel
	shell "cmd.exe /c dir f:\JRN022 > f:\JRN022\files.txt"
	Open(3, "f:\JRN022\filemove.log", 4)
	Open(4, "f:\JRN022\files.txt", 2)
	

;****** Gets filename and gets age in days

	:GetFile
	$f = ReadLine(4)
	if instr ($f,"free") 
	goto TheEnd
	else
	if right($f,4) > ".jnl" or right($f,4) < ".jnl"
	goto GetFile
	else
	$Fname=Right($f,12)
	$LogText=$Fname
	$DateStamp=left($f,8)
	$LogText=$LogText+$DateStamp

;****** +1 -1 in this section is to create a numeric variable

	$FileYear = 1 + right($DateStamp,2) - 1
	$LogText=$LogText+"  "+$FileYear
	$mn2 = right($DateStamp,5)
	$LogText=$LogText+" "+$mn2
	$FileMonth = 1+ left($DateStamp,2) - 1
	$LogText=$LogText+" "+$FileMonth
	$FileDay= 1 + left($mn2,2) - 1
	$LogText=$LogText+" "+$FileDay
	$FileDays=($FileYear*365)+($FileMonth*30.4167)+$FileDay
	$LogText=$LogText+" "+$FileDays
	$FileAge=$SystemDays-$FileDays
	$LogText=$LogText+" "+$FileAge

;******	Establish if file move is needed
;******	This routine will IGNORE files that match the specified criteria

	if $FileAge < 30
	goto GetFile
	Else

;******	Analyse FileName

	$FDay1 = right($Fname,6)
	$FDay = left($FDay1,2)
	$FMonth1 = right($Fname,7)
	$FMonth = left($FMonth1,1)
	$FYear1 = right($Fname,9)
	$FYear = left($FYear1,2)

;******	Convert month letter to Month name
;******	Added 01, 02 etc to month name to sort directories.

	:Month
	if instr ($FMonth,"A") > 0
	$FMonth = "01-January"
	goto FileN
	endif
	if instr ($FMonth,"B") > 0
	$FMonth = "02-February"
	goto FileN
	endif
	if instr ($FMonth,"C") > 0
	$FMonth = "03-March"
	goto FileN
	endif
	if instr ($FMonth,"D") > 0
	$FMonth = "04-April"
	goto FileN
	endif
	if instr ($FMonth,"E") > 0
	$FMonth = "05-May"
	goto FileN
	endif
	if instr ($FMonth,"F") > 0
	$FMonth = "06-June"
	goto FileN
	endif
	if instr ($FMonth,"G") > 0
	$FMonth = "07-July"
	goto FileN
	endif
	if instr ($FMonth,"H") > 0
	$FMonth = "08-August"
	goto FileN
	endif
	if instr ($FMonth,"I") > 0
	$FMonth = "09-September"
	goto FileN
	endif
	if instr ($FMonth,"J") > 0
	$FMonth = "10-October"
	goto FileN
	endif
	if instr ($FMonth,"K") > 0
	$FMonth = "11-November"
	goto FileN
	endif
	if instr ($FMonth,"L") > 0
	$FMonth = "12-December"
	goto FileN
	endif
	  
	$FMonth = "All"
 
; ***** Make directory and copy for old files

	$FilePath = "g:\Journal\"+$Srvah+"\PreFeb2000"
	
; ***** If filenames are less than 12 (8.3) characters then remove the blank characters
; *****	This is used for files older than feb2000



	:DirExist
	If exist ($FilePath) 
	goto CpyFile
	else md $FilePath
	endif
	goto CpyFile
	
	:FileN
	$HasSpace = instr ($FName," ")
	if $HasSpace = 0
	goto MakDir
	else
	$Fname=right($FName,(12-$HasSpace))
	endif
	
	:MakDir
	$FilePath = "g:\Journal\"+$Srvah+"\20"+$FYear+"\"+$FMonth
	If exist ($FilePath) 
	goto CpyFile
	else
	md $FilePath
	endif

; *****	Copy file

	:CpyFile
	$SFile="f:\JRN200\"+$Fname
	$DFile=$FilePath+"\"+$Fname
	$LogText=$LogText+" "+$DFile
	copy $SFile $DFile
	
	if exist ($DFile)
	goto GoodCopy
	else
	:BadCopy
	$LogText=$LogText+" COPY FAILED"+@crlf
	writeline(3,$LogText)
	goto GetFile
	endif
	
	:GoodCopy
	$LogText=$LogText+" copied"
	del $SFile

	If exist ($SFile)
	goto NoDelete
	else
	$LogText=$LogText+" and deleted"+@crlf
	writeline(3,$LogText)
	goto GetFile
	endif
	
	:NoDelete
	$LogText=$LogText+" but not deleted"+@crlf
	writeline(3,$LogText)
	goto GetFile
	
; ***** Program end and clean up

	:TheEnd
;	close open files
	close (3)
	close (4)
	
;	make copy of log file on central area

	$LogLoc="g:\journal\"+$Srvah+"\FileMove.log"
	del $LogLoc
	copy f:JRN200\FileMove.log $LogLoc
	del f:\JRN200\files.txt