|
|
|||||||
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 |
||||||||
|
|
|||||||
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:
|
||||||||
|
|
|||||||
hmm... that does not work remotely. so skip it |
||||||||
|
|
|||||||
ok, this works:
|
||||||||
|
|
|||||||
thx this is working great can i get the output to put the size of the file in as well? any ideas? |
||||||||
|
|
|||||||
Quote: this appears like the good olde black eagle on black background to me (working with a LCD display and Maxthon beta (fka MyIE2) |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
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) |
||||||||
|
|
|||||||
oh, you boys have the default template or something... fixing... |
||||||||
|
|
|||||||
better? |
||||||||
|
|
|||||||
yeah ... at least readyble now (don't mumble about style or so... looking good anyway) |
||||||||
|
|
|||||||
yep much better can read now any ideas on the file size showing? |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
yes please something like c:\temp\test.doc 2850 or something simular just so i can do some easier checking |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
k, try this:
this what you wanted? |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
trying this now will get back to you ASAP hopefully this will work thanks for help |
||||||||
|
|
|||||||
richard, I was thinking about running out of memory... this function is quite memory expensive on large drives... |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
what version of kix? |
||||||||
|
|
|||||||
kix32.exe version 4.22 |
||||||||
|
|
|||||||
Try this: Code: Break ON |
||||||||
|
|
|||||||
where would i add the filesize required in this new script? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
k i'm running it now thanks for all this help! |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
ok running code - i did it wrong first time i'll let you know what happens |
||||||||
|
|
|||||||
New recursion <1111> \\Homesrv\aam1402$\old profile\Application Data\Microsoft\Office\Shortcut Bar\Office thats the last line in the list |
||||||||
|
|
|||||||
remember, if it crashes, wanna know where. |
||||||||
|
|
|||||||
k. that's nice info, thanks. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 !! |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
thx richard, i'll see if this does the trick first.... hopefully it will other wise it will get more complicated thanks again Pete |
||||||||
|
|
|||||||
$item.islink denotes shortcut, so could try: if $item.isfolder and not $item.islink |
||||||||
|
|
|||||||
many thx that islink worked a treat thx again |