+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, AutoIt Script Help - Get Last Changed File in Coding and Web Development; Ok any autoit experts out there need to write a script that will look at files in directory find last ...
  1. #1

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,985
    Thank Post
    735
    Thanked 559 Times in 374 Posts
    Blog Entries
    3
    Rep Power
    206

    AutoIt Script Help - Get Last Changed File

    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

  2. #2
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: AutoIt Script Help - Get Last Changed File

    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

  3. #3
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: AutoIt Script Help - Get Last Changed File

    have made a start but i need some more details ??

  4. #4

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,985
    Thank Post
    735
    Thanked 559 Times in 374 Posts
    Blog Entries
    3
    Rep Power
    206

    Re: AutoIt Script Help - Get Last Changed File

    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

  5. #5
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: AutoIt Script Help - Get Last Changed File

    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.

  6. #6
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: AutoIt Script Help - Get Last Changed File

    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!

    Code:
    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

  7. #7

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,985
    Thank Post
    735
    Thanked 559 Times in 374 Posts
    Blog Entries
    3
    Rep Power
    206

    Re: AutoIt Script Help - Get Last Changed File

    Quote Originally Posted by ajbritton
    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

  8. #8
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: AutoIt Script Help - Get Last Changed File

    well give me a shout if you want another one and i will finish coding it.

  9. #9

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,985
    Thank Post
    735
    Thanked 559 Times in 374 Posts
    Blog Entries
    3
    Rep Power
    206

    Re: AutoIt Script Help - Get Last Changed File

    go one alonebfg always useful have to have few different scripts to choose from...

    Russ



SHARE:
+ Post New Thread

Similar Threads

  1. Delete certain file format using a script
    By FN-GM in forum Scripts
    Replies: 3
    Last Post: 27th December 2007, 01:17 AM
  2. Script to get all file on a url
    By Midget in forum Scripts
    Replies: 5
    Last Post: 23rd January 2007, 02:10 PM
  3. Replies: 4
    Last Post: 25th December 2006, 10:15 PM
  4. PHP flat file database script
    By ajbritton in forum Web Development
    Replies: 3
    Last Post: 26th October 2006, 09:51 PM
  5. Replies: 4
    Last Post: 23rd March 2006, 07:27 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •