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 6028021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:40:38+00:00 2026-05-23T04:40:38+00:00

I have a back up folder and a main folder in my project. I

  • 0

I have a back up folder and a main folder in my project. I am giving an option to user in main menu to open file from backup folder. For that i have written code:

        string[] paths;
        string fullpath = "";
        paths = Directory.GetFiles(backuppath);
        foreach (string backupfilepath in paths)
        {
            if (path.EndsWith(".txt"))
                fullbackupfilepath = backupfilepath;
        }

Here backuppath is the path of the backup file.
Now i copy this back up file in main project folder:

         File.Copy(fullbackupfilepath, mainprojectfilepath);

But i get the error that Could not find file C:\Users\me\Desktop\csharpproject\bin\debug\BackupProject.txt

Why is it going in bin debug folder when my project is in MyDocuments\Myproject. There is backupfolder inside this Myproject folder.
Please help with a solution.

  • 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-05-23T04:40:39+00:00Added an answer on May 23, 2026 at 4:40 am

    If you use relative path rather than absolute path, in runtime the base folder is the folder where the executable is located. In debug mode it’s bin/debug.

    It’s not advisable to have user files in the programs directory at all. I.e. if you install your program in Windows Vista or 7 programms folder, you will need admin rights to write into this directory.

    You should have a look at Environment.SpecialFolder.

    string yourAppPath = Path.Combine(
           Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
           "YourApp");
    

    This piece of code will generate a path for the current user, where you could store the files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datetime coming back from an XML file in the format: 20080916
I have a java back-end that needs to expose services to clients running in
I have to pass back information from a different source and can have a
I have a Stored Procedure that rolls-back a series of operations. I want to
I have an unusual environment in a project where I have many files that
We have large C++ project that we used to compile with the /MP switch
I've got a Visual Studio Setup Project that uses the msiexec.exe file to create
I have an app MainApp that references another project MyDLL.dll . Inside the MyDLL
I need to produce different WARs from a Maven project, according to values that
We have accidentally deleted the 'tags' folder from our Subversion repository where we only

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.