[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

C# Hidden Folder

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
ukerandi
Asked:
ukerandi
1 Solution
 
käµfm³d 👽Commented:
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
 
Daniel Van Der WerkenIndependent ConsultantCommented:
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
 
LordWabbitCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now