Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8607919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:29:00+00:00 2026-06-12T03:29:00+00:00

FileName=1.pdf,filepath=f:/test1 FileName=2.pdf,filepath=f:/test2 FileName=3.pdf,filepath=f:/test3 FileName=4.pdf,filepath=f:/test4 FileName=5.pdf,filepath=f:/test5 FileName=6.pdf,filepath=f:/test6 I don’t want to create a new file.

  • 0
FileName="1.pdf",filepath="f:/test1"
FileName="2.pdf",filepath="f:/test2"
FileName="3.pdf",filepath="f:/test3"
FileName="4.pdf",filepath="f:/test4"
FileName="5.pdf",filepath="f:/test5"
FileName="6.pdf",filepath="f:/test6"

I don’t want to create a new file. Overwriting in a same file is ok

I tried the following.

var reader = File.OpenText("f:/test5");
reader. // ?

I don’t know what to put after reader. If any alternate way is there, provide me a solution.I want to remove only a particular line based on the unique file name. If I am having 5.pdf as the filename, then I need to delete or remove the entire line which is “FileName=”5.pdf”…line from the file. I don’t want to overwrite the contents in a new file again. Provide me a solution. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:29:02+00:00Added an answer on June 12, 2026 at 3:29 am

    You cannot reomve a line from a textfile without rewriting the file. Do something like this

    string filename =
       Path.Combine(
           Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
           "Test1.txt");
    
    string[] lines = File.ReadAllLines(filename);
    var list = new List<string>(lines);
    list.RemoveAt(4);
    File.WriteAllLines(filename, list.ToArray());
    

    EDIT:

    You can find a line with a specific filename like this:

    int index = list.FindIndex(s => s.EndsWith("/test5\""));
    // Or whatever test is appropriate.
    
    if (index >= 0) {
        list.RemoveAt(index);
        File.WriteAllLines(filename, list.ToArray());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<embed width=100% height=100% src=filename.pdf type=application/pdf> I can embed a PDF file into a web
In a PHP project I need to Create a PDF file and redirect to
I want to show all PDF filenames that has 33 in any position. sample
public void EditAndSave(String fileName) { Bitmap b = new Bitmap(fileName); /** * Edit bitmap
I have a ASP.NET SOAP web service whose web method creates a PDF file,
I have the following string: string path = C:\Users\Username\Desktop\FileName.pdf; I need to take off
I want to download a file from server to a local host. i have
I want to download a file and save it locally without any pop ups
Im sarching how to create a safe filename in my webapplication I had read
I'm having some issues getting my pdf file to display in my jsp page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.