Solved

C# Hidden Folder

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

Expert Comment

by:käµfm³d 👽
Comment Utility
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 19

Expert Comment

by:Daniel Van Der Werken
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now