#138039 - 2005-04-15 12:25 PM
$file variable question
|
AndyK
Fresh Scripter
Registered: 2005-03-29
Posts: 8
|
Hi, I am using the WriteProfileString command. I want to output file name, file location and modified date to a txt file.
I have managed to get the name and modified date done using $file.name and $file.datelastmodified. But I cannot find how to output the location. I have tried $file.location and $file.path, that just throws the whole thing out and leaves the output txt file blank. Does anyone know what $file variable I should be using.
Thanks,
Andy
|
|
Top
|
|
|
|
#138042 - 2005-04-15 02:04 PM
Re: $file variable question
|
AndyK
Fresh Scripter
Registered: 2005-03-29
Posts: 8
|
Hi Les, I am using it in after calling the dirplus udf. Complete script below:
Call 'C:\Documents and Settings\username\Desktop\dirplus.kix' $files = Dirplus("c:\","/a-d /s /f exe") For Each $file In $files $ = WriteProfileString('\\server\share\log.ini',@USERID,$file.name,$file.datelastmodified)
Next
Thanks,
Andy
|
|
Top
|
|
|
|
#138044 - 2005-04-15 03:44 PM
Re: $file variable question
|
AndyK
Fresh Scripter
Registered: 2005-03-29
Posts: 8
|
Fair enough - being a kix novice and not knowing what FSO and COM are I did not know the exact context of how I was using it was important and that there would be a generic answer. So - just to clarify - does that whole passage of script need to be copied into my script?
Thanks
|
|
Top
|
|
|
|
#138046 - 2005-04-15 04:47 PM
Re: $file variable question
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
something liek this?
Code:
$files = Dirplus('.\','/a-d /s /f kix')
For Each $file In $files $ = WriteProfileString('.\test.ini',@USERID,$file.name,$file.datelastmodified + ',' + $file.path) Next
will make a ini file like this.
Code:
[bsmith] test.kix=4/15/2005 9:34:54 AM,G:\kix\sandbox\test.kix 800k.kix=3/4/2005 3:30:46 PM,G:\kix\sandbox\800k.kix av.kix=1/25/2005 5:07:51 PM,G:\kix\sandbox\av.kix bryce's NicSpeed.kix=3/16/2005 6:03:33 PM,G:\kix\sandbox\bryce's NicSpeed.kix fncCheckAV.kix=1/26/2005 5:05:46 PM,G:\kix\sandbox\fncCheckAV.kix months.kix=2/17/2005 6:58:31 PM,G:\kix\sandbox\months.kix mx2.kix=12/16/2004 4:26:47 PM,G:\kix\sandbox\mx2.kix NicSpeed.kix=3/16/2005 6:18:20 PM,G:\kix\sandbox\NicSpeed.kix outlook.kix=4/12/2005 12:31:37 PM,G:\kix\sandbox\outlook.kix pc.kix=1/3/2005 11:37:57 AM,G:\kix\sandbox\pc.kix quota.kix=2/24/2005 11:55:42 AM,G:\kix\sandbox\quota.kix shutdown.kix=12/21/2004 4:34:55 PM,G:\kix\sandbox\shutdown.kix skincalc.kix=2/10/2005 1:45:37 PM,G:\kix\sandbox\skincalc.kix temp.kix=1/6/2005 10:31:58 AM,G:\kix\sandbox\temp.kix vendetta.kix=12/2/2004 2:43:01 PM,G:\kix\sandbox\vendetta.kix xchat.kix=12/7/2004 5:30:49 PM,G:\kix\sandbox\xchat.kix
|
|
Top
|
|
|
|
#138048 - 2005-04-15 05:23 PM
Re: $file variable question
|
AndyK
Fresh Scripter
Registered: 2005-03-29
Posts: 8
|
Hi Bryce, That's it! the variable I was using was correct, but I had it set ou like this: $ = WriteProfileString('\\server\shares\log.ini,@USERID,$file.name,$file.datelastmodified,$file.path)
Thanks everso much for that, one other question. using dirplus, is there a way of searching using part of the filename? the command in dos is dir c:\blah*.exe Looking through the dirplus kix, it shows you can search on extension, but all the ways I have tried to add the part of the filename it, it fails.
Thanks again
Andy
|
|
Top
|
|
|
|
#138052 - 2005-04-15 10:22 PM
Re: $file variable question
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Quote:
just wonder... if he wants executable files or just exe-files. with that dirplus stuff, only the latter is suitable.
what do you mean by executable vs just exe?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|