Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# stream file
I am trying to convert a folder & it's contents (files & sub-folders) to a single stream which will be returned to some application. The problem is that I cannot compress the folder. Now, I want to know that whether there's a way to modify the attributes or type of a folder so that it will be treated as a single but unknown file. So that I can read it using a single FILESTREAM object.
 
Another way that I could think of is to return an array of stream which will contain the stream of all the files inside the root folders & sub-folders. Along with that a text/xml file also in stream, which will store the location of each file inside the Stream array.
Posted 16-Jun-13 21:57pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The best way would be to create some class that would return all the data as a stream. Inside the class you would iterate through all the files and read their data from disk, passing it back to the caller. The only issue would be how you identify the end of one file and the beginning of another.
  Permalink  
Comments
piyush_singh at 17-Jun-13 10:20am
   
It is for this I decided initially to go for the Array of Streams where an index of an array represents a single file only. Along with that the 1st index of the Array will contain the Stream of a comma delimited String data type which will contain the physical location of each file so that at the time of parsing, i will read a files path (including it's name) from the string and subsequently the file will be parsed by another application. Still not very sure whether it will work or not. Thanks for the advice anyways.
Richard MacCutchan at 17-Jun-13 12:26pm
   
The only thing I can suggest is that you try it, as it is not very clear what you are actually trying to achieve with this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,127
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100