48 users online (0 members and 48 guests)  


  Results 1 to 5 of 5

Related

  1. Find the file a page is generated from    Forum: PHP Forum
    Replies: 3
  2. Local applications    Forum: CGI Perl Forum
    Replies: 1
  3. Replies: 0
  4. Open file in local directory    Forum: CGI Perl Forum
    Replies: 0
  1. #1
    smell_fire's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    4

    Find File On Local Hard Drive

    Is there a script that can be instructed to search a specific folder on your hard drive for files. Sort of like the windows find file feature.

    It would be nice to have an input box where you enter your search & the results show up in a box where you can click on the file you want and it will open.

    Thankyou.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi, welcome to the forums.

    Your only chance would be to author/find an ActiveX control.

    Unfortunately, ActiveX controls are so powerful that most users will not enable or download them.

    Might be safer to instruct your users to press F3, this brings up the windows search feature
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    smell_fire's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    4
    This project would be run locally from our own hard drive and not posted to the net, so security would not be an isssue.

    I ran across this script but it will not open the files, it only lists the files.
    It would be nice to have the location to search already in the script so the user does not have to enter the location of the folder.

    <HTML>
    <HEAD>
    <TITLE></TITLE>
    </HEAD>
    <style>
    .Field {color: black; border: 1px solid #FFFFFF; background-color: #FFCC00;}
    .Find {color:blue; font: 10px Arial;}
    </style>
    <script>
    var Fo =new ActiveXObject("Scripting.FileSystemObject");
    var StrOut = new String();
    var FileName = new String();
    var Extention = new String();

    function FindFile(FOo)
    {
    var FSo = new Enumerator(FOo.Files);
    for(i=0;!FSo.atEnd();FSo.moveNext())
    {
    if(FileName == "*" || FSo.item().name.slice(0,FSo.item().name.lastIndexOf(".")).toLowerCase().indexOf(FileName)>-1)
    if(Extention == "*" || FSo.item().name.slice(FSo.item().name.lastIndexOf(".")+1).toLowerCase().indexOf(Extention)>-1){
    StrOut += "<tr "+ ((i%2)? "":"bgcolor=#DDAA55") +"><td width=50%><font class=find>" + FSo.item().name + "</font></td><td width=25%><font class=find>" + FSo.item().type + "</font></td><td width=50%><font class=find>"+ String(FSo.item().size/(1024*1024)).slice(0,3) +" MB</font></td></tr>";
    i++
    }
    }
    }

    function Scan()
    {
    FileName = (search.value.lastIndexOf(".")>-1)? search.value.slice(0,search.value.lastIndexOf("."))search.value.length>0)? search.value.toLowerCase():"*"; //Get Searched File Name
    Extention = (search.value.lastIndexOf(".")>-1)? search.value.slice(search.value.lastIndexOf(".")+1).toLowerCase():"*"; // Get Searched File Extention Name

    if(path.value.length>0 && Fo.FolderExists(path.value)){
    StrOut = "<table border=0 width=100% cellspacing=0>"
    FindFile(Fo.GetFolder(path.value));
    outPut.innerHTML = StrOut+"</table>";
    }
    else alert("Insert Correct Path Address");
    }
    </script>

    <BODY topmargin="0" leftmargin="0">

    <table border=0 width=100% cellspacing="0" style="border-collapse: collapse" cellpadding="2"><tr>
    <td dir="ltr" bgcolor="#FFCC00"><b><font face="Arial" size="2">Named :
    </font></b> </td>
    <td dir="ltr" bgcolor="#FFCC00">
    <input size=50 type=text id=search name=search class="Field"></td>
    </tr><tr>
    <td dir="ltr" bgcolor="#FFCC00">
    <p dir="ltr"><b><font face="Arial" size="2">Path : </font></b> </td>
    <td bgcolor="#FFCC00">
    <input size=50 type=text value="C:\" id=path name=path class="Field" ></td>
    </tr><tr>
    <td bgcolor="#FFCC00">&nbsp;</td>
    <td bgcolor="#FFCC00">
    <input type=button value=" Scan " onclick=Scan() class="Field"></td>
    </tr><tr>
    <td colspan=2 align=right bgcolor="#FFCC00"><font face=arial size=2><b>Search Result</b></font><hr></td>
    </tr><tr>
    <td colspan=2 bgcolor="#FFCC00"><div id=outPut></div></td>
    </tr></table>
    </BODY>
    </HTML>
    Last edited by smell_fire; 12-03-2003 at 01:28 PM.

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I'm not much good with ActiveX, sorry.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    smell_fire's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    4
    Thanks anyway



Tags for this Thread