Can we search different files in a directory!!!

Hello!!!
I have a simple question.Suppose we have a directory containingg different types of files,say zip,rar,txt,gif etc.Now if we want to show only txt files to client then how to do that.
I am using jsp.
I want to show my client only text files contained in that directory.
Please help me how to implement this.
Thanks in advance.

Thanks man!!!
Atleast i got the enough information that kept me going.
These forums rock mam!!!

Similar Messages

  • How can i traverse between files in a directory

    how can i traverse between files in a directory. I ahve seen in the site that isFile can be used to switch from one file to other but i didn't found such method. I am working in Eclipse. I would be thankful if u send me the solution.I mean the way to traverse

    listFiles() returns all the files in a directory. You can check if it is a file and read it. Read the API docs.
    If you have specific problem with your code, post the code and the problem description.

  • When importing files, my view window to search for files is really small, how do I make it bigger so I can actually search for files?

    When importing files, my view window to search for files is really small, how do I make it bigger so I can actually search for files?

    How big this is depends on the size of your screen. On a 13" it is really small. But you can improve things a bit. Click the green button to make the import window fill the screen.
    Drag the area between the file list and the preview area up or down to increase one or the other:

  • How do I exclude directories from Finder search results? I'm trying to find the biggest FILES on my computer and it keeps showing me "Macintosh HD" as the biggest, how can I search for files of type "NOT folder/directory"?

    Basically I've lost 10GB of free space over the last few weeks so my plan was to search for files modified in the last 2 weeks in order to figure out which ones are big and where that space went.
    So I open finder, go to "File > Find", and enter a search:
    Modified > In the last 2 weeks
    All fine so far.
    Problem is, it's showing whole directories as results. Which essentially means that when I order the list by size, Macintosh HD is at the top, followed by "Users", then "Applications", then one of my bigger movie files, then "Library", etc.
    How can I do a search which will ignore folders? I want individual files. Knowing that Macintosh HD is the biggest item on my computer and was modified in the last 2 weeks is utterly useless to me.
    Older versions of Finder in OS 9 had a feature where you could search for "files, whose type "IS NOT" folder", but OS X doesn't seem to have such a feature.
    Can anyone help?

    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is likely the easiest/best, and is now free...
    http://www.omnigroup.com/applications/omnidisksweeper/download/

  • How can I search a file system and only return newer files?

    Sorry the title didn't give me much room to work with. I'm writing a tool which needs to track all the files in an OS. What I'd like to do is make it so my program will only return files that have been modified/created since the last search to add to my program. I was wondering if there's an efficient way to do this other than checking each file's timestamps? Also is there a way to tell from a parent directory whether any files in its directory have been modified/created? I'm looking for ways for Windows and Linux.

    I have no problem checking timestamps but it can be rather time consuming doing this. I don't know if this is quicker but I'd like to sort by modified date and check the time stamps for newer timestamps than the last time I ran. This way if I hit a time stamp equal to my last run I know to stop there. I checked Windows and the folder does tell you whether any file was created/modified in it's directory. However, if a file is created in one of its children's directories it won't update the time stamp. It's unfortunate because I could've avoided the search at a higher level directory otherwise. Without this I'll have to walk the whole structure one way or another. I can still improve the speed but I can't make it as efficient as I'd like.

  • Search through files in a directory

    How do I get a list of the files in a directory? I am aware of JFileChooser but it is not what I am looking. I need to search the contents of the xml files in the directory. I can do this with one file but need to do it with them all.

    // where files in subdirectory \files below the application directory
    File dir = new File(".\\files\\");
      if(dir.exists()){
        File[] list = dir.listFiles();
        for (int i = 0; i < list.length; i++){
          String fileName = list.toString();
    int iPtr = fileName.lastIndexOf("\\");
    int jPtr = fileName.indexOf(".xml",0);
    if (jPtr>-1) {
    String longName = fileName;
    String shortName = fileName.substring(iPtr + 1, jPtr);
    // file name in short name

  • How can I search different App Stores on the iPad without creating accounts for them?

    I'm doing some research on the contents of different App Stores, and the only search feature that gives me all the data I need is the iPad store under iOS 5 or earlier. However, I cannot search a different store without creating an account and signing in, and to create an account I have to have a billing address in that store's country. iTunes on my Mac will let me search various stores without signing in (as long as I don't try to download), but iTunes doesn't give me all the information I need. Does anyone have any ideas for using iPad to search different stores without signing in?
    Thanks!

    This will make a permanent change to the store location for that ID (at least, until I change it back). That *may* be useful (I won't know for a few hours because I don't have the iPad with me right now), but it's not what I want. Within the App Store I want to search a different store without having to sign in. I can do this easily enough in iTunes on my MBP and would really like to do it on the iPad too (because the iTunes app search doesn't give me all the info I need).
    Thanks for the idea; stay tuned. I'll get back to you as soon as I get the chance to try it.

  • How can I search for files on multiple servers at one time?

    When I hit command+F, and use spotlight to search for files, I'm only given the opportunity to search for those files in three places: "This Mac", "Shared", and then the server or external HD that is mounted. However, in the past I was able to check a box for all mounted/connected servers/HDs, and then do a search in all of them at the same time. I CAN'T FIND THIS OPTION IN LEOPARD AND IT IS ANNOYING ME BIG TIME.
    Hopefully there is a simple solution that I've overlooked.
    Please help!

    no

  • How can I put a file in a directory server extracted by a abap report?

    Hi!
    I need to extract data from r/3 server by a report and put the output into one file in a directory of the server.
    In Abap code someone know how can I do that?
    Thanks!

    Hi,
    I post this in the Abap forum but the response are very poor to make this. So, I think to post the message in XI forum because I work with thing of XI and I know that someone know how to put the file in the same server that I take out the data.
    Tuhin give me a excellent link to make that!
    Thanks!

  • How can I: Search for files "not in catalog"

    Is there a way to search for files/photos on my hard drive that are *NOT* already in my catalog?
    (a) I can do a mass search to find all photos on my hard drive.
    (b) And there is a reconnect feature - for all entries in catalog with a missing/invalid link, look for the file that matches best.
    But I'd like to have Elements find photos that I have not added to the catalog.
    That is, do (a), but check each one to see if it is already added.
    Is there a way to do that?
    Thanks,
      -ceej

    What you want to achieve by finding those files?
    In folder view you can see the folder which have no media files in Organizer.
    If you import all the files form all the drives on your system, by deafult you will see files just imported into catalog. That means, just after import ou will have the files which were not in your catalog :-)
    I know my  answer could be confusing for you, but it will make sense if you know what happens after import in Organizer...

  • How can I search for files in System and Library folders

    This arrose when I tried to find Archive Utility.app. Neither a Finder search or Spotlight found it, apparently because it is in Hard Drive/System/Library/CoreServices and the System folder is not searched. I've had similar problems when trying to find things in Library. How can I search these folders?

    You can enable the Finder to include System files in its search
    In a Finder finder window select Kind then Other… locate System files in the list and click the checkbox.

  • How can I search for files with more than one keyword?

    I´ve created some keywords, and some files in my folder are tagged with two, three or more keywords.
    Is there a way to search for files using more than one keyword on the search field?
    Thanks!

    Use the Find command (menu Edit) and in criteria at the right side is a plus sign to add another criteria and set it to your custom wishes.
    make a choice in results and you should be OK

  • Give a handmake function to search all files in the directory.

    To scan drive, folder, ets.
    I maked this, but my function is big bleep, a devil will break his legs here.
    Need small workable solution.
    Attachments:
    function.txt ‏7 KB

    Sergey,
    Here is an example file which looks through every file in a directory.http://zone.ni.com/devzone/cda/epd/p/id/2157
    It should save you some time if you are having issues with your code. 
    Regards,
    Kyle Mozdzyn
    Applications Engineering
    National Instruments
    Regards,
    Kyle M.
    Applications Engineering
    National Instruments

  • How to search for file in a directory or subdirectories?

    I need ur help urgently. I'm currently doing a java project in which the program should be able to do file searching.
    For eg. if I key in a.jpg, it should display C:\pictures\a.jpg (a.jpg is stored in a folder called "pictures")
    But the problem is that my program is only able to search in the C drive only.
    If I move the file into a folder in the C drive, my program cannot detect this.
    Can you help me to solve this problem? I'm really looking forward for your reply.
    Thanks. Here are the codes.
    import java.io.*;
    import java.awt.*;
    class FindFile
         public static void main(String args[]) throws IOException
              //reads the user input
              BufferedReader userInput;
              while(true)
                        userInput = new BufferedReader(new InputStreamReader(System.in));
                        String s = userInput.readLine();
                        //quits the system               
                        if(s.equals("/quit"))
                             System.exit(0);
                        //if user does not key in anything, prompt msg appear
                        else if(s.equals(""))
                             System.out.println("Command Syntax: java ListFiles <filename>");
                             System.out.println("<filename> - The full name of a file and extension (i.e., test.txt)");
                        else if(userInput != null)
                             String t = "c:";
                             File f = new File(t);
                             String[] files = f.list();
                             char[] qwet;
                             boolean test = false;
                             //check for the file name and compare with the user input
                             for (int i = 0; i < files.length; i++)
                                  if(files.equals(s))
                                       System.out.println("");
                                       System.out.println("File Found");
                                       System.out.print("The File Found at This Path: ");
                                       //display the path
                                       System.out.print(f.getAbsolutePath());
                                       System.out.println(files[i]);
                                       test = true;
                                       break;
                             //if file does not exist
                             if(test == false)
                                  System.out.println("File Not Found");

    well, i think the best solution would be make a recursive search through the directory tree. I don't know if you are familiar to this, but the functions that searches for the file would look like this:
    public String searchFile(String name) {
      File[] roots = File.listRoots();   // List all file roots (in windows the different units, c:, d:, etc.)
      for (int i = 0 ; i < roots.length() ; i++) {
        String aux = recursiveSearch(roots, name);
    if (aux != null) {   // If the "recursiveSearch" returns something different than null is that the file is founded, so we return the path.
    return aux;
    return null; // If we get there nothing has been found
    private String recursiveSearch(File f, String name) {   // f is the directory to search for the file with name "name"
    File[] childs = f.listFiles();
    for (int i = 0 ;i < childs.length ; i++) {
    if (childs[i].isDirectory()) {  // If that is a directory we search inside
    String aux = recursiveSearch(childs[i], name);
    if (aux != null) {   // We have found it inside this directory
    return aux;
    } else {  // Is a regular file
    if (name.compareTo(childs[i].getName()) == 0) {   // If the file is what we want we return his path
    return childs[i].getCanonicalPath();
    // If we get here is because the file is not inside the directory or any subdirectory on it
    return null;
    You should just call the function searchFile(name) with the name of the file you want to search. If it finds one with this name it will return his absolute path, and if he doesn't the desired file he will return null.
    If you don't understand anything just ask.
    (Note: i have not tested this code, so can be some mistakes, but it think it is almost correct. mmmhh don't now why, but [ & ] appear in my code as < & >. Just replace them.).
    Hope that helps.
    Zerjio

  • How can I search for files in the "Save As" dialogue when saving attachment

    I receive a lot of graphics via email that are updates to existing graphics for a website. When I click on "Save Attachment As..." on the pop-up menu within Mail, a finder-like window appears that has a little search oval on it. I would like to be able to use this to find an existing file on my hard drive that I can select and replace with the file that I'm attempting to save. The only thing that I'm able to bring back is folders. Even when I click on "filename" and use the + sign and change to "name". No files appear in the search. When I get to the folder that I want, I still have to scroll forever to find the file name that I'm looking for. Can anyone tell me what I'm doing wrong or possible offer a better solution to my problem? Thanks in advance for any advice.

    You can enable the Finder to include System files in its search
    In a Finder finder window select Kind then Other… locate System files in the list and click the checkbox.

Maybe you are looking for