Jump to content

problems with FileGetTime Function


Recommended Posts

Dear All

I try to use AUTOIT to fetch the last modified time of some files

But with this code , I got nothing output with var $t , $t1

the c:\erp\pbd.txt does exists and contain correct datas .

and I do not know what`s wrong ?

Please help , thanks .

#include <file.au3>
If FileExists("c:\erp\pbd.txt") Then
    FileDelete("c:\erp\pbd.txt")
EndIf

RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE)

$count_lines = _FileCountLines("c:\erp\pbd.txt")

$file = FileOpen("c:\erp\pbd.txt", 0)
$i = 1
While $i <= $count_lines
    $line = FileReadLine($file)
    
    $t = FileGetTime("c:\erp\" & $line, 0)

        $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0)
    
    $i=$i+1
WEnd
FileClose($file)
Link to comment
Share on other sites

Dear All

I try to use AUTOIT to fetch the last modified time of some files

But with this code , I got nothing output with var $t , $t1

the c:\erp\pbd.txt does exists and contain correct datas .

and I do not know what`s wrong ?

Please help , thanks .

#include <file.au3>
If FileExists("c:\erp\pbd.txt") Then
    FileDelete("c:\erp\pbd.txt")
EndIf

RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE)

$count_lines = _FileCountLines("c:\erp\pbd.txt")

$file = FileOpen("c:\erp\pbd.txt", 0)
$i = 1
While $i <= $count_lines
    $line = FileReadLine($file)
    
    $t = FileGetTime("c:\erp\" & $line, 0)

        $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0)
    
    $i=$i+1
WEnd
FileClose($file)
Hi there,

1st - where is $line?

2nd - try this to use Ubound

Cheers

Edited by november

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

  • Developers

Dear All

I try to use AUTOIT to fetch the last modified time of some files

But with this code , I got nothing output with var $t , $t1

the c:\erp\pbd.txt does exists and contain correct datas .

and I do not know what`s wrong ?

Please help , thanks .

#include <file.au3>
If FileExists("c:\erp\pbd.txt") Then
    FileDelete("c:\erp\pbd.txt")
EndIf

RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE)

$count_lines = _FileCountLines("c:\erp\pbd.txt")

$file = FileOpen("c:\erp\pbd.txt", 0)
$i = 1
While $i <= $count_lines
    $line = FileReadLine($file)
    
    $t = FileGetTime("c:\erp\" & $line, 0)

        $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0)
    
    $i=$i+1
WEnd
FileClose($file)
I do not see anywhere in your script how you handle the received information in variable $t and $t1 ...

Hi there,

1st - where is $line?

2nd - try this to use Ubound

Cheers

1st = The line below while ?

2nd = Ubound on what ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I do not see anywhere in your script how you handle the received information in variable $t and $t1 ...

yap , sorry , I deleted one more line ....

the code should be like this .....

#include <file.au3>
If FileExists("c:\erp\pbd.txt") Then
    FileDelete("c:\erp\pbd.txt")
EndIf

RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE)

$count_lines = _FileCountLines("c:\erp\pbd.txt")

$file = FileOpen("c:\erp\pbd.txt", 0)
$i = 1
While $i <= $count_lines
    $line = FileReadLine($file)
    
    $t = FileGetTime("c:\erp\" & $line, 0)

        $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0)
    msgbox(4096,"title",$t)
    $i=$i+1
WEnd
FileClose($file)
Link to comment
Share on other sites

FileGetTime() returns an array be default, unless you add the "format flag":

; $t = FileGetTime("c:\erp\" & $line, 0)
    $t = FileGetTime("c:\erp\" & $line, 0, 1)

Now, as penance for not reading the help file, say 20 "Hail Katrijn's", and do 20 hours of pro bono coding for the poor...

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...