Page 1 of 1 1
Topic Options
#30645 - 2002-10-14 07:57 PM Search entire HD?
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
What's the best way to search an entire drive for a specific file? I have used the "exist" function in the past when I've known where the file would be located by default. Now I need to seach the entire hard drive and delete a file specified by users input. The file could be located in more than one location on the same drive, adn I need to remove all instances of the file.

Anyone have a good suggestion?

Thanks

JTT

Top
#30646 - 2002-10-14 08:18 PM Re: Search entire HD?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
dir file.ext /s /b

[ 14. October 2002, 20:23: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#30647 - 2002-10-14 08:19 PM Re: Search entire HD?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I believe the DIRPLUS UDF has some of this functionality too..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#30648 - 2002-10-14 08:19 PM Re: Search entire HD?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You can use the DirPlus() UDF at http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000027. However, the performence hit will be tremendous. Therefore, yi might be better to knwo beforehand the rough are where the file is located. If you would provide more info, like why the file is needed, what file it is, there might be another solution.
_________________________
There are two types of vessels, submarines and targets.

Top
#30649 - 2002-10-14 08:38 PM Re: Search entire HD?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Heres a quickly script based on Radimus's suggestion. Just pretends to delete:

break on

; settings ...

$filemask = "t.kix"
$tempfile = "%temp%\out.tmp"

; if tempfile exists, delete it ...

if exist($tempfile)
 del "$tempfile"
endif

; enumerate all files into tempfile ...

shell '%comspec% /c dir "$filemask" /s/b >"$tempfile"'

; open tempfile and pretend to delete ...

if open(1,$tempfile) = 0
 $filename = readline(1)
 while @error = 0
  if $filename
   ?"delete $filename"
  endif
  $filename = readline(1)
 loop
 $=close(1)
endif

exit


-Shawn

[ 14. October 2002, 20:39: Message edited by: Shawn ]

Top
#30650 - 2002-10-14 09:09 PM Re: Search entire HD?
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
We have an Access front end to a SQL Databse that is constantly being updated. The front end is place on users desktops, either locally or on one of three Terminal Servers. We have recently been relying on the end user to remove the old version when the new version exists, but as I'm sure you are aware is not the best or most reliable solution.

I've done several "log-in" scripts that in the past and was hoping to use Kixtart to write a script that would allow me to enter in the file name and perform a search and delete of all existences of the file on the terminal servers from the console itself.

I know I could edit the logon scripts to get this to work, but it's not desired because of the need to remove the files before the update because of diminishing disk space. I am hoping to perform the updates and removal before the next business day, preferrably at night.

Top
#30651 - 2002-10-14 09:34 PM Re: Search entire HD?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should really create a special folder/location for the Access front-end and then update it through a login or admin script. The user should not have a choice as to where to save the front-end file.

Also, if you have only Windows NT/2000/XP systems, then you can connect remotely to the administrative drive shares C$, D$,... and remotely search the HDs for the obsolete files.

[ 14. October 2002, 21:36: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#30652 - 2002-10-15 10:05 PM Re: Search entire HD?
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
Thanks for all the great suggestions. I think I'm going to sit down with the programmer and force some standardization in where and how we do the updates. That will allow me to write a script that will work for every user.

Thanks again.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2175 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.058 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

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