DickG Posted December 17, 2015 Posted December 17, 2015 Local $ThisFunc = "Delete" $CurDir = @WorkingDir $Ask = MsgBox(3, $ThisFunc, "Delete " & $CurDir & "?") If $Ask = 6 Then DirRemove($CurDir & "\", 1)This code deletes all files and subfolders under the parent, but leaves the parent folder.Running AutoIt v3.3.14.2 on WinXP SP3.
Exit Posted December 17, 2015 Posted December 17, 2015 (edited) C:\>md test C:\>cd test C:\test>rmdir . Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird. C:\test>cd .. C:\>rmdir test C:\>You cannot delete the current directory Edited December 17, 2015 by Exit App: Au3toCmd UDF: _SingleScript()
DickG Posted December 17, 2015 Author Posted December 17, 2015 Does this mean that DirRemove() leaves the empty folder? The Help file says "Deletes a directory/folder." I didn't see anything that says it doesn't delete the specified folder. Now I'm confused. How do I delete the empty folder? Do I have to go to the folder's parent to delete it?
Developers Jos Posted December 17, 2015 Developers Posted December 17, 2015 This means that you are not able to delete a directory when a program has a file open or the has the directory set as its WorkingDirectory.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DickG Posted December 17, 2015 Author Posted December 17, 2015 OK, thanks. I found my problem. I didn't realize that @WorkingDir referred to the selected folder's parent.If I select a file in a file manager (I use DOpus), then read $CMDLINERAW, it shows that folder's parent, rather than the selected folder (like I expected). Once I realized that, I was able to fix my code to handle that.Thanks for your help.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now