473,387 Members | 3,684 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,387 software developers and data experts.

System.IO.File.Move

why does System.IO.File.Move("c:\\hmbug.jpg", "c:\\foodoo\\foo.jpg"); throw
access denied? im just moving a file in a console app? any ideas?
Nov 16 '05 #1
2 5428
Hi Daniel,

Does the destination file already exist? Is some other program accessing hmbug.jpg (might well be one of your own previous compilation which is still running).

If the target file already exists you need to delete it first.

if(File.Exists("c:\\foodoo\\foo.jpg"))
File.Delete("c:\\foodoo\\foo.jpg");

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Make sure that the directory foodoo exists and you have write permission
in the directory. Another reason could be that the file hmbug.jpg is
locked by some process or your own process and hence cannot be moved.
Try moving the file from windows explorer while your app is running.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
Daniel wrote:
why does System.IO.File.Move("c:\\hmbug.jpg", "c:\\foodoo\\foo.jpg"); throw
access denied? im just moving a file in a console app? any ideas?

Nov 16 '05 #3

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

Similar topics

2
by: vince | last post by:
MSDN help says you can use a UNC path for any methods that accept a path, and I'm wondering if I can also substitute an IP address for the UNC....??? Example: Using System.IO.File.Move() ...
6
by: Chad | last post by:
I am receiving the following two errors in the code below. Both are on Line 56. error C2039: 'CreateDirectoryA' : is not a member of 'System::IO::Directory' error C2660: 'CreateDirectoryA' :...
2
by: vince | last post by:
MSDN help says you can use a UNC path for any methods that accept a path, and I'm wondering if I can also substitute an IP address for the UNC....??? Example: Using System.IO.File.Move() ...
3
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer...
4
by: Steffen Loringer | last post by:
Hi all, which of the asp.net files on my development system must be transfered to the "final" server system to make the application working? And which of the "Directory" option in IIS need to be...
1
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens...
6
by: John Pye | last post by:
Hi all I have a tricky situation that's preventing my Python/SWIG/C application from running on the Debian Etch AMD64 platform. It seems that the 'dl' module is not available on that platform....
8
by: jkeith07 | last post by:
Ok so ive reached the end of my knowledge and have tried to find out how to do it and just plain dont understand it. I have a system call: system("db2cmd.exe \"db2 connect to vop9 user...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.