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.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top