c# - Why am I getting exception Directory Is Not empty? -


this question has answer here:

i have line:

directory.delete(outputfiles, true); 

if set true should delete subdirectories , files. checked directory empty deleted next time. before exception in directory had 4 subdirectories , in 1 of them had zip file of 7 mb size.

system.io.ioexception unhandled   hresult=-2147024751   message=the directory not empty.    source=mscorlib   stacktrace:        @ system.io.directory.deletehelper(string fullpath, string userpath, boolean recursive, boolean throwontopleveldirectorynotfound)        @ system.io.directory.delete(string fullpath, string userpath, boolean recursive, boolean checkhost)        @ diagnostic_tool_blue_screen.createdirectories.createdirectoriesatconstructor() in d:\c-sharp\diagnostic tool blue screen\diagnostic tool blue screen\diagnostic tool blue screen\createdirectories.cs:line 35        @ diagnostic_tool_blue_screen.form1..ctor() in d:\c-sharp\diagnostic tool blue screen\diagnostic tool blue screen\diagnostic tool blue screen\form1.cs:line 125        @ diagnostic_tool_blue_screen.program.main() in d:\c-sharp\diagnostic tool blue screen\diagnostic tool blue screen\diagnostic tool blue screen\program.cs:line 19        @ system.appdomain._nexecuteassembly(runtimeassembly assembly, string[] args)        @ microsoft.visualstudio.hostingprocess.hostproc.runusersassembly()        @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)        @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)        @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state)        @ system.threading.threadhelper.threadstart()   innerexception:  

according msdn:

if recursive parameter true, user must have write permission current directory subdirectories.

could user doesn't have write permission?

or one:

in cases, if have specified directory open in file explorer, delete method may not able delete it.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -