---
title: "Read Specific textfile in streamreader"  
description: "Read Specific textfile in streamreader"  
author: "Anonymous User"  
published: 2013-11-14  
updated: 2013-11-14  
canonical: https://www.mindstick.com/forum/1737/read-specific-textfile-in-streamreader  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Read Specific textfile in streamreader

I want to read many delimited [files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud) from a folder. However, the calling in the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is per one textfile only.

System.IO.StreamReader [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) =new System.IO.StreamReader(@"C:\[Orders](https://answers.mindstick.com/qa/43206/what-were-the-fundamental-orders-of-connecticut-and-who-wrote-them)\OrdersForImport.txt");

I want the "OrdersForImport.txt" to be change.

my textfiles are OrdersForImport, OrdersForImport1, OrdersForImport2, OrdersForImport3, etc.

it is [constant](https://www.mindstick.com/forum/34714/difference-between-statics-vs-constant-in-c-sharp) that the ".txt" extention will not be change. only the filenames will be change

## Replies

### Reply by Anonymous User

Hi Ashish,

You'll have to run a loop and read all of them then ...

You could do something like

```
var name_array ="name1.name2.name3".Split(".");and then look and same the input likevar sb = new StringBuilder();foreach (var entry in name_array){   var name = entry +".txt";   // read your file here giving the `name` to the streamreader }
```


---

Original Source: https://www.mindstick.com/forum/1737/read-specific-textfile-in-streamreader

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
