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

  • Home
  • SEARCH
  • 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 8104749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:57:11+00:00 2026-06-05T23:57:11+00:00

I have a directory D:\AAAA\BBBB\CCCC and using C# I want to move this directory

  • 0

I have a directory D:\AAAA\BBBB\CCCC and using C# I want to move this directory to D:\DDDD.

Result I want to achieve is the directory at: D:\DDDD\AAAA\BBBB\CCCC

I am using following line of code:

System.IO.Directory.Move("D:\\AAAA","D:\\DDDD");

But it throws an System.IOException with the message:

Cannot create a file when that file already exists.

Please guide me.

  • 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-05T23:57:17+00:00Added an answer on June 5, 2026 at 11:57 pm

    If you are looking for something more like a merge to an already existing directory, then I think the only way to do it is to write your own method to create the directories and move the files manually (like Tim Schmelter’s comment). Otherwise, you could delete an existing directory if it exists first, but that seems dangerous.

    Here is a SO about merging. The answer is a Copy, so just add a final delete for the origin if you want something closer to a move

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

Sidebar

Related Questions

My company's code base contains the following C# line: bool pathExists = Directory.Exists(path); At
let's say i have directory paths looking like this: this/is/the/basedir/path/a/include this/is/the/basedir/path/b/include this/is/the/basedir/path/a this/is/the/basedir/path/b In
I have a directory containing multiple subdirectories. I want to list only those subdirectories
I have a function $result = create_watermark( 'input_file_name' ,'output_file_name'); I have directory called /images
I have a directory with lots of files in them. I just want to
I have a directory of arbitrary files I want to include in my jar
I have a directory structure as follows dir----| | |--dir1\ some\ thing--result.pdf | |--dir2\
I have a directory with a bunch of XML documents and want to put
I have a directory with a ton of files I want to find the
I have directory with following structure root temp User_related_folder preview1.jpg preview2.jpg preview3.jpg I need

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.