Page 2 of 3 <123>
Topic Options
#125047 - 2004-08-16 02:56 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Most common cause is forgetting to avoid the "." and ".." entries (self and parent).

Not in this case though

It could be a memory leak.

Try adding "$shell=0" just before the function exit.


Edited by Richard H. (2004-08-16 03:05 PM)

Top
#125048 - 2004-08-16 03:12 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
trying this now will get back to you ASAP

hopefully this will work

thanks for help

Top
#125049 - 2004-08-16 03:15 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
richard, I was thinking about running out of memory...
this function is quite memory expensive on large drives...
_________________________
!

download KiXnet

Top
#125050 - 2004-08-16 03:18 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
the machine i'm working on as 1.5GB of RAM and there is lots free so i can't see it is running out of ram..... well at least i think it isn't
Top
#125051 - 2004-08-16 03:23 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
the kix32.exe process got to around 52mb and then crashed with the same message as b4

any more ideas?

i had over 1200mb of memory free at this point as well

Top
#125052 - 2004-08-16 03:31 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
what version of kix?
_________________________
!

download KiXnet

Top
#125053 - 2004-08-16 03:34 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
kix32.exe version 4.22
Top
#125054 - 2004-08-16 03:39 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Try this:
Code:
Break ON

$=SetOption("WrapAtEOL","ON")

Global $iRecursiveDepth
Global $oShell

$oShell=createobject("shell.application")

drivescan("\\CLIENTPC\c$")
"Done." ?

Function drivescan($sPath)
Dim $oItem

For Each $oItem in $oShell.namespace($sPath).items
If $oItem.isfolder
$iRecursiveDepth=$iRecursiveDepth+1
"New recursion <"+$iRecursiveDepth+"> "+$oItem.path ?
drivescan($oItem.path)
$iRecursiveDepth=$iRecursiveDepth-1
EndIf
Next
Exit 0
EndFunction


Top
#125055 - 2004-08-16 03:45 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
where would i add the filesize required in this new script?
Top
#125056 - 2004-08-16 03:47 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
you don't need it.
try running script and see does it crash.

if it does, tell us what is the last line on console.
if it doesn't, we (richard) will rethink.
_________________________
!

download KiXnet

Top
#125057 - 2004-08-16 03:49 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
k i'm running it now

thanks for all this help!

Top
#125058 - 2004-08-16 03:53 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
The script is a "debug" version, to try and get a handle on how and why you are getting the exception.

You need to ensure it runs through to completion before you start to worry about adding other features.

Something like this will do you however:
Code:
Break ON
$=SetOption("WrapAtEOL","ON")

Global $iRecursiveDepth
Global $oShell

$oShell=createobject("shell.application")

drivescan("\\SGB007968\c$")
"Done." ?

Function drivescan($sPath)
Dim $oItem

For Each $oItem in $oShell.namespace($sPath).items
If $oItem.isfolder
$iRecursiveDepth=$iRecursiveDepth+1
"New recusion <"+$iRecursiveDepth+"> "+$oItem.path ?
drivescan($oItem.path)
$iRecursiveDepth=$iRecursiveDepth-1
Else
If 2799<$oItem.size AND 2901>$oItem.size
"*** File match "+$oItem.size+" "+$oItem.path ?
EndIf
EndIf
Next
Exit 0
EndFunction


Top
#125059 - 2004-08-16 03:56 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
ok running code - i did it wrong first time i'll let you know what happens
Top
#125060 - 2004-08-16 04:10 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
New recursion <1111> \\Homesrv\aam1402$\old profile\Application Data\Microsoft\Office\Shortcut Bar\Office

thats the last line in the list

Top
#125061 - 2004-08-16 04:10 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
remember, if it crashes, wanna know where.
_________________________
!

download KiXnet

Top
#125062 - 2004-08-16 04:11 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
k.
that's nice info, thanks.
_________________________
!

download KiXnet

Top
#125063 - 2004-08-16 04:40 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Holy Cow!

Well, you've got a loop in there alright. The recursion level should be about 10 for that directory path depth!

Perhaps you are picking up a shortcut to a directory or share name which refers back to a higher level directory. You will need to redirect the output to a file or something, and spot when it goes haywire.

Basically, the recursion depth should be the same as the directory depth below your start directory.

Top
#125064 - 2004-08-17 09:34 AM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
ok i think i've sorted out that problem

it had found a "nethood" directory with loads of shortcuts in

for a quick fix i removed this directory (it was nothing important)

now to see what happens next

thanks for all the help so far !!

Top
#125065 - 2004-08-17 09:59 AM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
ok i've found the problem

how can i get it so if the script finds a folder called "NetHood" it doesn't go down and look in this folder?

Pete

Top
#125066 - 2004-08-17 11:10 AM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Simplest is probably to change this line:
Code:
If $oItem.isfolder



to read:
Code:
If $oItem.isfolder AND Not InStr($oItem.path,"Nethood")



NB, if shortcuts are the problem you may well find them in other folders, so you may want to consider finding a smarter method.

Top
Page 2 of 3 <123>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 180 anonymous users online.
Newest Members
gkustra, emnipetro, Hirze, thequeen, ameliaryan
17642 Registered Users

Generated in 0.04 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org