Jump to content

Script wont retrieve file modify date


Recommended Posts

Global $File, $T, $Search, $Data

; Shows the filenames of all files in the current directory
$Search = FileFindFirstFile("Accounts\*.ini")

; Check if the search was successful
If $Search = -1 Then
 MsgBox(48,"Error","No files found, sure you got the right dir?")
EndIf

;Find File Names If Any...
While 1
 $File = FileFindNextFile($Search)
 If @error Then ExitLoop

 $T = FileGetTime($File)

 If @error = 0 Then
  ConsoleWrite($File & " " & $T[0] & "/" & $T[1] & "/" & $T[2])
  $Data = $T[0]
  ;Check last modified date
  If $Data <= 2009 Then
   ConsoleWrite("File: " & $File & " is older!!! Time: " & $Data & @CRLF)
  endif
 Elseif @error = 1 then
  ConsoleWrite("Error checking date on File: " & $File & @CRLF)
 endif
WEnd

; Close the search handle
FileClose($Search)

this does not what it should...

it should show me last modified date, but it always says error retrieving it.

any ideas?

Damian666

Edited by damian666
and proud of it!!!
Link to comment
Share on other sites

Please repost code within AutoIt tag, what got posted this way is a Royal pain!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

it should show me last modified date, but it always says error retrieving it.

any ideas?

I think you should take again a look to FileGetTime function help. You are using:

FileGetTime($File, 0, 1)

and after that you try to use an array so you should change the format option from 1 to 0

FileGetTime($File, 0, 0)

I hope this helps... and yes, it's a pain the code you posted ;-)

Regards,

sahsanu

Link to comment
Share on other sites

Working here. But wait, do you run it thru SciTE or compiled? If the first case you'll see console output, but not in the latter case except using a way to grab stdout and display it somehow. Use MsgBox instead to test it compiled.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

i runned it in scite, i know it wont show debug msg outside it ^^

ill try doing it with msgbox for the heck of it, ill report back in a sec...

Damian666

edit:

nope, with msgbox and compiled, it still shows me error, no date O.o

is it possible it wont show this info for ini files?

Edited by damian666
and proud of it!!!
Link to comment
Share on other sites

Don't take it bad if I ask[ed] basic question and point out things you already happen to know. Sometimes, long-time users pop up and raise elementary issues. There's no hurt anyway.

.ini files are just files. Are you sure you have necessary access rights for that operation in this directory? Also, are you running the latest release of AutoIt (3.3.6.1)?

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Hi,

try instead of $T = FileGetTime($File)

$T = FileGetTime(@ScriptDir & "\Accounts\" & $File)

FileFindNextFile returns only the filename. !! So it checks in wrong directory !!

;-))

Stefan

Link to comment
Share on other sites

Stefan,

Must be why it fails. Not having an Accounts directory handy, I removed that part. But you make it clear that it won't work if another directory than CWD is selected.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

We all miss the obvious at times!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...