Page 1 of 3 123>
Topic Options
#125027 - 2004-08-16 11:04 AM 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
hi

is it possible to do this? i can't seem to even get started on this one....

i need to search a PCs local drives for a file between these two sizes, damn management.........

Pete

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
depends how good you wanna do it.
if it's one time job (meaning, not all the time) and on one pc at a time, something like this should do the job:

removed


Edited by Jooel (2004-08-16 11:55 AM)
_________________________
!

download KiXnet

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
hmm...
that does not work remotely.
so skip it
_________________________
!

download KiXnet

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
ok, this works:

for each $file in drivescan("\\pc2lonkero\c$")
$file ?
next
get $

function drivescan($drive,optional $reserved)
dim $shell,$item,$root
if not $reserved redim $drivescan $root=$drive endif
$shell=createobject("shell.application")
for each $item in $shell.namespace($drive).items
if $item.isfolder
$drivescan=$drivescan+drivescan($item.path,1)
endif
if 2799<$item.size and 2901>$item.size
$drivescan=$drivescan+$item.path+chr(10)
endif
next
if $drive=$root
$drivescan=split($drivescan,chr(10))
redim preserve $drivescan[ubound($drivescan)-1]
endif
endfunction


Edited by Jooel (2004-08-16 12:20 PM)
_________________________
!

download KiXnet

Top
#125031 - 2004-08-16 11:58 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
thx this is working great

can i get the output to put the size of the file in as well?
any ideas?


Edited by Peter Fry (2004-08-16 12:09 PM)

Top
#125032 - 2004-08-16 12:07 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6373
Loc: Stuttgart, Germany
Quote:

ok, this works:
<table width="500" bgcolor="black" fontcolor="red"><tr><td>
for each $file in drivescan("\\pc2lonkero\c$")
$file ?
next
get $

function drivescan($drive,optional $reserved)
dim $shell,$item,$root
if not $reserved redim $drivescan $root=$drive endif
$shell=createobject("shell.application")
for each $item in $shell.namespace($drive).items
if $item.isfolder
$drivescan=$drivescan+drivescan($item.path,1)
endif
if 2799<$item.size and 2901>$item.size
$drivescan=$drivescan+$item.path+chr(10)
endif
next
if $drive=$root
$drivescan=split($drivescan,chr(10))
redim preserve $drivescan[ubound($drivescan)-1]
endif
endfunction
</td></tr></table>




this appears like the good olde black eagle on black background to me (working with a LCD display and Maxthon beta (fka MyIE2)

_________________________



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

Registered: 2001-06-05
Posts: 22335
Loc: OK
ja.
if there is not a single such file on the drive/dir you are scanning, that happens.

change it to something like:
if ubound($drivescan)>0
redim
endif
_________________________
!

download KiXnet

Top
#125034 - 2004-08-16 12:11 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
you're a star

working with it now

any idea how to get the file size to output on the same line as the file name?

Pete

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
wonder what you mumble?
I work with LCD display too.
the table has 2 colors.
if your display can't show black&white graphics and text, I recommend doing something to it

or what the heck?
me not sure...
black eagle, black black... what?
_________________________
!

download KiXnet

Top
#125036 - 2004-08-16 12:14 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
well i have to highlight the text to be able to read it when you put it on the black background, not complaining as you're writing some good code (far better than i can do)
Top
#125037 - 2004-08-16 12:16 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
oh, you boys have the default template or something...
fixing...
_________________________
!

download KiXnet

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
better?
_________________________
!

download KiXnet

Top
#125039 - 2004-08-16 12:30 PM Re: Seach machines hardrives for a file between 2800kb and 2900kb
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6373
Loc: Stuttgart, Germany
yeah ... at least readyble now (don't mumble about style or so... looking good anyway)
_________________________



Top
#125040 - 2004-08-16 12: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
yep much better can read now

any ideas on the file size showing?

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
jochen, I just didn't get ya.
in my black&blue template it showed just fine so had no idea what you bitching about

peter, what you mean about showing?
you wanna see the size too?
_________________________
!

download KiXnet

Top
#125042 - 2004-08-16 12:51 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
yes please something like
c:\temp\test.doc 2850

or something simular

just so i can do some easier checking

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
so, you don't want all the files that are of some size but you want the sizes of all files on all directories on some harddisk?
can't see any usage for such...
but, if you want manual method, you shall get it...
still can't understand why.
_________________________
!

download KiXnet

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

Registered: 2001-06-05
Posts: 22335
Loc: OK
k, try this:

drivescan("\\pc2lonkero\c$")
get $

function drivescan($drive,optional $reserved)
dim $shell,$item,$root
if not $reserved redim $drivescan $root=$drive endif
$shell=createobject("shell.application")
for each $item in $shell.namespace($drive).items
if $item.isfolder
drivescan($item.path,1)
endif
if 2799<$item.size and 2901>$item.size
$item.size " " $item.path ?
endif
next
endfunction


this what you wanted?
_________________________
!

download KiXnet

Top
#125045 - 2004-08-16 01:28 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
well what i want is this
i'll try and make it as easy as possible

given a list of machines (prolly around 300)
search there local harddrives for a file that is size 2546176 in size (but as some people have edited this file i wanted to capture the ones that were greater than this up to say around 2800000)
list the files that it finds with the size
so i see
c:\test.doc 2546176
c:\temp\test.doc 2734000

what i'm going to need but i think i can do this is
get the following output
machine=testpc
c:\test.doc 2546176
c:\temp\test.doc 2734000
-----------------
machine=testpc2
-----------------
machine=testpc3
-----------------
machine=testpc5
c:\test.doc 2546176
c:\temp\test.doc 2734000

so i can see which machines have the file size and which ones don't

does that make sense?

basically a very sensitive file from HR has been leaked out to the network and the management are asking me to see if i can locate any copies on peoples harddrives

people have renamed this file and some might have changed the size buy adding a few extra characters

does this make sense now?

Top
#125046 - 2004-08-16 02:21 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
one thing when i run this on a large drive i get
Stack overflow exception.
The common cause for this type of exception is an endless recursive loop.
Please check your script(s) for endless loops.
is there anyway to stop this?

Top
Page 1 of 3 123>


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

Who's Online
0 registered and 176 anonymous users online.
Newest Members
diefnet, Arogya, gkustra, emnipetro, Hirze
17644 Registered Users

Generated in 0.041 seconds in which 0.01 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