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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top