CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985

    Java File System: How to search for files in a directory and subdirectories?

    Q: How to search for files in a directory and subdirectories?

    A: The following small program when executed like this:

    Code:
    java FileList *
    should print a list of files in the current directory

    Code:
    // sample from Absolute Java FAQ
    
    public class FileList
    {
      public static void main(String args[])
      {
        for (int i = 0;i < args.length; i++)
        {
          System.out.println("File " + i + ":" + args[i]);
        }
    
        if (args.length<=0)
        {
          System.out.println("No files!");
        }
      }
    }
    Last edited by Andreas Masur; December 11th, 2005 at 07:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured