Solved

C# Hidden Folder

Posted on 2015-01-14
3
130 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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