Solved

C# Hidden Folder

Posted on 2015-01-14
3
139 Views
Last Modified: 2015-01-28
I have already created EXE file and there is some text files in the folder.
I need to copy to CD (write to CD) to EXE file and Folder (With all text files). That folder i need to hidden/Invisible from Client.

Any one have any better idea how to that. Many Thanks
0
Comment
Question by:ukerandi
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40550277
That folder i need to hidden/Invisible from Client.
You do realize that clients can still "Show hidden files" in their Explorer window's options and see your files, yes? Assuming you're OK with that, then the files should copy over to CD with their "hidden" attribute in tact.
0
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 40551737
Did kaufmed's answer resolve this?

Not sure what you're really going for here, so it's hard to know what to recommend. You can't really hide files from users if they have access to the system. You might be able to do some fancy tricks likes store them into an encrypted zip file or something, but I don't know.
0
 
LVL 11

Accepted Solution

by:
LordWabbit earned 500 total points
ID: 40553501
You could also use alternate data streams on ntfs and when burning to disk change them to UDF named streams, there will still be a file, but it will have zero bytes, with all the data in the alternate data stream.  The following code uses a library that can be found here

        private static void CreateFileStream()
        {
            string filePath = System.IO.Path.Combine(location, "MyFile.txt");
            System.IO.File.WriteAllText(filePath, "");
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
            var alternateStream = fileInfo.GetAlternateDataStream("Hidden").OpenWrite();
            byte[] byteMe = System.Text.ASCIIEncoding.ASCII.GetBytes("This is how the world ends, not with a bang, but with a whimper.");
            alternateStream.Write(byteMe, 0, byteMe.Length);
        }

        private static void ReadFileStream()
        {
            string filePath = System.IO.Path.Combine(location, "MyFile.txt");
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
            var alternateStream = fileInfo.GetAlternateDataStream("Hidden").OpenRead();
            byte[] byteMe = new byte[alternateStream.Length];
            alternateStream.Read(byteMe, 0, byteMe.Length);
            string msg = System.Text.ASCIIEncoding.ASCII.GetString(byteMe);
            Console.WriteLine(msg);
        }

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question