How to Access and Display Network Folder Contents in C#?

  • Thread starter Thread starter Ian_Brooks
  • Start date Start date
  • Tags Tags
    Material Network
AI Thread Summary
To create a program in C# that retrieves and lists the contents of a folder on a network drive, it's essential to understand file handling and network protocols. The program can be designed to accept a path input and utilize XML to manage file information. By writing an XML file that specifies how to handle files, the program can read and display file names effectively. C# supports socket communication, allowing for data retrieval between machines. To list files, implement an iteration method that checks for file existence and outputs names as strings. Accessing network folders can be done by mapping them to a drive or using a direct path format like \\server\folder\. Clarification is needed regarding the request to preview files in a database format, as the term is ambiguous.
Ian_Brooks
Messages
127
Reaction score
0
For a small personal project I was wondering how could I have a program obtain the contents of a folder in a network drive?

List the filenames in the folder and let us preview the files in a database form format using C#?I'd be happy to put in the path name into a field and when the program first opens.

any help?
 
Technology news on Phys.org
Well if you know XML, you can create a program that uses resource calls to retrieve and store the information needed.

I haven't used C# before, but it should have a tool that can open sockets between two machines so you can retrieve and pass information.

Thus, create your program to look any way you decide, but the main points is having an XML file that directs how to handle files from the network drive. You write the XML so your program reads a list of the contents (maybe from an html file located at the server summarizing the contents), and you can program in C# to obtain that information using the instructions from the XML (you should have some stream writing function).

If you're trying to trying to preview the types of files you have, as in, retrieving the names of the files, you can just create an iteration in your program to search for content, and if null, stop the search, and write the name of the files as strings in your program.

I would read up on using C# in conjuction with file handling protocols like XML (or even REST). What I just summarized above is what you would need to get it working.
 
Provided that I understand you correctly; there is no difference in how you iterate through local files or files residing on a network folder.

Either map the network folder to a drive or access the share through a \\server\folder\ path.

I'm lost as to what "preview files in database form format" means, sorry.

k
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top