Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Determining If a File Is Hidden in Programming

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 09-02-2010
Member
 
Join Date: Nov 2009
Posts: 85
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.
Reply With Quote
  #2  
Old 09-02-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,775
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")

Reply With Quote
  #3  
Old 09-02-2010
Modifier's Avatar
Member
 
Join Date: Jan 2008
Posts: 1,372
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

Reply With Quote
  #4  
Old 09-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,816
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.
Reply With Quote
  #5  
Old 09-02-2010
Member
 
Join Date: May 2008
Posts: 1,844
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;
            }
        }

Reply With Quote
  #6  
Old 09-02-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 1,987
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);

Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "Determining If a File Is Hidden in Programming"
Thread Thread Starter Forum Replies Last Post
Copy, move, rename file via programming HiSpeed Software Development 5 14-11-2009 05:07 PM
Where is located hidden file/folder for x3watch artom3 Windows Software 2 13-07-2009 02:16 PM
How to view hidden file in dos TAMAR Operating Systems 3 29-06-2009 03:17 PM
JetBrains Introduces a New Programming Paradigm With its Meta Programming System JoeFrat Software Development 3 13-12-2008 12:49 PM
Unable to connect hidden file shares kampmalm Windows Vista Network 3 21-01-2008 07:27 AM


All times are GMT +5.5. The time now is 01:09 AM.