Results 1 to 6 of 6

Thread: Determining If a File Is Hidden in Programming

  1. #1
    Join Date
    Nov 2009
    Posts
    877

    Determining If a File Is Hidden in Programming

    Hello, I want to know the details about the Finding If a File Is Hidden or not with the help of Programming. So, if anyone is having knowledge about it, then please tell me how to write code to get it. I have tried to read different books for it, but don't get the solution for it. So, if you are having idea about it, then please provide that to me.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Determining If a File Is Hidden in Programming

    Hey, if you make use of the Visual basic then it is quiet simple for you to get the solution for your code. For that you need to make use of the object of the class FileInfo on the file which you want to check. For that you need to make use of the code below:
    Code:
    Dim infoReader As System.IO.FileInfo
    infoReader = My.Computer.FileSystem.GetFileInfo("C:\check.txt")

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Determining If a File Is Hidden in Programming

    Hello, if you need it in the visual basic then you can simply make use of the following code which will make use of the object of the FileAttributes. And it will take the FileAttributes from the FileInfo object as below:

    Code:
    Dim reader As System.IO.FileAttributes
    reader = infoReader.Attributes

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Determining If a File Is Hidden in Programming

    Hello, I am not having anything details about the checking the hidden files. But, I have read that you can make use of the code below:
    Code:
    return !file.isHidden();
    I have not used it, but you can make use of it, I think it will solve your problem.

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: Determining If a File Is Hidden in Programming

    Hey, I have got the code below for you which will simply tell your whether the file is hidden or not:
    Code:
    System.IO.FileAttributes fileattrib = System.IO.File.GetAttributes("File Path");
                if ((fileattrib & System.IO.FileAttributes.Hidden) == System.IO.FileAttributes.Hidden)
                {
                    MessageBox.Show("Hidden");
                }
    
             private bool IsOpened(string str)
            {
                try
                {
                    System.IO.File.OpenWrite(str);
                    return true;
                }
                catch (System.UnauthorizedAccessException e)
                {
                    return fileattriblse;
                }
            }

  6. #6
    Join Date
    May 2008
    Posts
    2,297

    Re: Determining If a File Is Hidden in Programming

    If you want to determine whether the file is hidden or not then you need to make use of the java code below:
    Code:
    JFileChooser JChoose = new JFileChooser();
    File fName = new File("c:\\Program Files"); 
    fName = new File("c:\\a.txt");
    boolean isHidden = JChoose.getFileSystemView().isHiddenFile(fName);

Similar Threads

  1. How to run batch file hidden in dos window
    By Alfanumeric in forum Windows Software
    Replies: 6
    Last Post: 26-06-2011, 08:01 AM
  2. Copy, move, rename file via programming
    By HiSpeed in forum Software Development
    Replies: 6
    Last Post: 21-03-2010, 09:26 PM
  3. Help with determining if PSU is sufficient
    By Zankuu in forum Motherboard Processor & RAM
    Replies: 2
    Last Post: 25-12-2009, 10:48 PM
  4. How to view hidden file in dos
    By TAMAR in forum Operating Systems
    Replies: 3
    Last Post: 29-06-2009, 03:17 PM
  5. Replies: 3
    Last Post: 13-12-2008, 01:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,719,924.28162 seconds with 17 queries