Jump to content
Sign in to follow this  
damian666

Script wont retrieve file modify date

Recommended Posts

damian666

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!!!

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
Share on other sites
sahsanu

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

Share this post


Link to post
Share on other sites
damian666

ok, reposted xD

sorry about that, and i fixed that filegettime one, that was not what it should be, but after i fixed that, its still not doing anything O.o

Damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
Share on other sites
damian666

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!!!

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
Share on other sites
99ojo

Hi,

try instead of $T = FileGetTime($File)

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

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

;-))

Stefan

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
Share on other sites
damian666

lol... so simple ... xD

sorry to waste your time guys ^^

thank you very much, and jchd, i didnt take it the bad way man, just glad you were willing to help :idea:

Damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
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
Sign in to follow this  

×