Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Ok any autoit experts out there need to write a script that will look at files in directory find last file to be changed and place it in variable...

 

Anyideas

 

cheers

 

Russ

Posted
explain exactly what you are after and i will be happy to write a script for you have done about 30 now from installing software to network searches for .mp3 and jpegs the first bit is easy do you want to select what variable or browse to ?? also is the directory always the same or will you browse to it
Posted

Hi idea is the backup solution currently produces logs backup1.log, backup2.log all way to backup9.log and rotates itself so finds oldest and replaces with the new log.

 

Right need a script that will find latest aka last changed file and email it to me (this can be either via script or by the script calling blat.

 

Russ

Posted

That sounds like you are looking up the most recent NTBackup log Russ.

 

If that's the case, there might be 2 other solutions.

 

1 - Modify the NTBACKUP command line to place the log file in a place of your choosing so that your script can pick it up directly

 

or

 

2 - Use BackupAssist, which will analyze the log for you and email you a lovely looking HTML report.

Posted

Funnily enough, I have written something to do just what you ask I now remember. I never used it though, so thorough testing is advised!

 

Func GetLatestFile($DirPath, $FileSpec)

; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile($DirPath & "\" & $FileSpec)  

$LatestFile = ""
$LatestTime = 0

; Check if the search was successful
If $search = -1 Then
   MsgBox(0, "Error", "No files/directories matched the search pattern")
Else
While 1
	$file = FileFindNextFile($search) 
	if @error then ExitLoop
	
	if StringInStr(FileGetAttrib($DirPath & "\" & $file), "D") > 0 Then
		; Skip directories
	Else
		$FileTime = FileGetTime($DirPath & "\" & $file,0,1)
		if $FileTime > $LatestTime Then
			$LatestFile = $File
			$LatestTime = $FileTime
		EndIf
	EndIf
WEnd
EndIf

Posted
That sounds like you are looking up the most recent NTBackup log Russ.

 

If that's the case, there might be 2 other solutions.

 

1 - Modify the NTBACKUP command line to place the log file in a place of your choosing so that your script can pick it up directly

 

or

 

2 - Use BackupAssist, which will analyze the log for you and email you a lovely looking HTML report.

 

For various reasons I don't want to do number one as want to leave current way it is setup.

 

 

Will have look at script and any others sent my way..

 

Russ

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...