473,379 Members | 1,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Renaming folder problems


Hello,
I am trying to rename a folder by using
Directory.Move(soucrceFolder,destFolder) but keep getting the following
error:
Cannot create a file when that file already exists.

Why can it happen? Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
1 985
On Sun, 04 May 2008 05:38:30 -0700, csharpula csharp
<cs*******@yahoo.comwrote:
>
Hello,
I am trying to rename a folder by using
Directory.Move(soucrceFolder,destFolder) but keep getting the following
error:
Cannot create a file when that file already exists.

Why can it happen? Thanks!
Quoting MSDN:

"This method throws an IOException if, for example, you try to move
c:\mydir to c:\public, and c:\public already exists. You must specify
"c:\\public\\mydir" as the destDirName parameter, provided that
"mydir" does not exist under "c:\\public", or specify a new directory
name such as "c:\\newdir"."

What are the specific values for "sourceFolder" and "destFolder" in
your case? Does "destFolder" already exist?

Regards,
Gilles.

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: peter | last post by:
Hello all, Recently I've started to refactor my code ...(I'm using python 2.3.4) I tried to add extra functionality to old functions non-intrusively. When I used a construct, which involves...
0
by: Joe | last post by:
How can I rename a folder that has the same name, but with different character casing? When I do either of the following, I get an error saying "Source and destination path must be different.": ...
0
by: MikeY | last post by:
Hopefully someone can help, I have a listview box where I display my desired files. I single click on the desired file to be renamed and I rename it with a new name. My problem arises when the...
2
by: cloudx | last post by:
Hi there, it is driving me crazy. Aftering renaming app.config the following code I always get null on myApp. It works if I keep the name app.config. Why? string myApp =...
3
by: MisterG | last post by:
Hi, In my code, I rename a folder and then the asp.net application restarts ! So i've lost my session variables ... How is it possible for the application asp.net to restart when you rename a...
1
by: Jason B | last post by:
Hello, I have been trying to figure out how to rename my IIS directories and still have the project be able to run through VS. I have renamed the directories listed in the csproj.webinfo file and...
8
by: BillCo | last post by:
I'm updating a legacy app with table naming that makes baby jesus cry. It's a bit of a spider web though... no telling when and where the tables will be called by name. So I wrote this for renaming...
1
by: evaisse | last post by:
I've a folder structure like this : "Folder A" |--"1" |--"2" ---"3" "Folder B" |--"4" ---"5"
2
by: djcamo | last post by:
Hi, I'm hoping some one can help with some coding issues I'm having. Below is some code I use to rename a file if it already exists in a folder. As you can see I have 5 nested if loops which means...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.