?
Solved

I need some help with a Directory.delete problem.

Posted on 2008-10-22
6
Medium Priority
?
382 Views
Last Modified: 2013-12-17
I have created a C# Console application that automatically goes into a folder and cleans up some subfolders. When running the script it works fine for the most part. but on certain folders. i get the following error:

Access to path '<drive>:\users\<users folder>\<subfolder>' is denied.

I have checked my permisions on the files/folders and on all of them i have full permissions for all files, folders, and subfolders. so why am i getting this message? any help would be appreciated.


System.IO.Directory.Delete(path_to_delete, true);

Open in new window

0
Comment
Question by:tosmserversupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
RishadanPort earned 1500 total points
ID: 22781831
This could happen if a file is currently in use by another program, or the current application.
0
 

Author Comment

by:tosmserversupport
ID: 22781844
I will look into this and see if that is the problem. thank you for your prompt response.
0
 
LVL 3

Expert Comment

by:trunghieubkit
ID: 22783435
You may be opening the folder by the Explorer

0
Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

 

Author Closing Comment

by:tosmserversupport
ID: 31508994
thank you for your help. it appears that there is a process running on the server which is preventing it from being deleted.
0
 

Author Comment

by:tosmserversupport
ID: 22787048
Thanks everyone for their prompt reply. it seems a program is accessing the files while i am attempting to delete them. I will write some code to remove these locks before deleteing the folders.
0
 
LVL 6

Expert Comment

by:RishadanPort
ID: 22788761
Did I answer your question fully? I am just wondering why you gave the grade of "B". Usually you give the grade B when your answer was not answered fully
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question