fly Posted November 3, 2005 Posted November 3, 2005 Okay, this is some code I have in a function: ElseIf FileExists($datastore & "\" & GUICtrlRead($userCombo)) Then $overwrite = MsgBox(20, "Uh-oh", "Directory already found for user. Overwrite?") If $overwrite = 6 Then ;MsgBox(0, "del", "deleting dir: |" & $datastore & "\" & GUICtrlRead($userCombo) & "|") ;DirRemove($datastore & "\" & GUICtrlRead($userCombo), 1) $vUserCombo = GUICtrlRead($userCombo) ;$datastore = "\\usmtserv1\backup$" $test = DirRemove($datastore & "\" & $vUserCombo, 1) MsgBox(0, "fdsf", $test) Else MsgBox(0, "Well then...", "Please remove/rename existing datastore directory") EndIf It will see that the folder exists on my server, but refuses to actually delete the folder (although I get a return code of 1, saying it was successfully deleted.) What am I doing wrong? Please excuse the comments, I've been running tests to try and see what I'm doing wrong. Thanks for any help.
BigDod Posted November 3, 2005 Posted November 3, 2005 Could it be a permissions issue. Have you tried deleting manually to check if it can be done outside of the script. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
fly Posted November 3, 2005 Author Posted November 3, 2005 Could it be a permissions issue.Have you tried deleting manually to check if it can be done outside of the script.Yes. I can def delete the folder. sorry, I should have mentioned that.
BigDod Posted November 3, 2005 Posted November 3, 2005 Yes. I can def delete the folder. sorry, I should have mentioned that.Try using the DirRemove command with the full pathname instead of variable to see if that does it.I am clutching at straws here. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
fly Posted November 3, 2005 Author Posted November 3, 2005 Try using the DirRemove command with the full pathname instead of variable to see if that does it.I am clutching at straws here.Nope.HmmmIf I take the DirRemove out of the function, it works fine.
bboysza Posted November 3, 2005 Posted November 3, 2005 Nope.HmmmIf I take the DirRemove out of the function, it works fine.Can you msgbox $userCombo before DirRemove to see if there's any unwanted characters in there?Ormsgbox(0, "", $datastore & "\" & GUICtrlRead($userCombo))If that's Ok then maybe...$Dir2Rem = $datastore & "\" & GUICtrlRead($userCombo) DirRemove($Dir2Rem, 1) Ben
fly Posted November 3, 2005 Author Posted November 3, 2005 Can you msgbox $userCombo before DirRemove to see if there's any unwanted characters in there?Ormsgbox(0, "", $datastore & "\" & GUICtrlRead($userCombo))If that's Ok then maybe...$Dir2Rem = $datastore & "\" & GUICtrlRead($userCombo) DirRemove($Dir2Rem, 1)Yeah, I put in MsgBox(0, "del", "deleting dir: |" & $datastore & "\" & GUICtrlRead($userCombo) & "|")to see if there were any extra characters or spaces, and everything looked right.The 2nd code you gave me also gives me a return code of 1, meaning it deleted, but didn't delete anything either.
BigDod Posted November 3, 2005 Posted November 3, 2005 (edited) Could the "$" in $datastore = "\\usmtserv1\backup$" be causing problems. Still clutching at straws. Edit - If it is you could map a drive letter to it instead. Edited November 3, 2005 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
fly Posted November 3, 2005 Author Posted November 3, 2005 Could the "$" in $datastore = "\\usmtserv1\backup$" be causing problems.Still clutching at straws.Edit - If it is you could map a drive letter to it instead.Good thought. I tried mapping the drive like this:$Dir2Rem = "U:\" & GUICtrlRead($userCombo) $test = DirRemove($Dir2Rem, 1) MsgBox(0, "fdsf", $test)Still didn't work. I have to be doing something wrong, cause it works outside the function...
BigDod Posted November 3, 2005 Posted November 3, 2005 Could you post the whole function to see if that gives some clues. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
blademonkey Posted November 3, 2005 Posted November 3, 2005 (edited) Are you trying to delete the contents of the share? or are you trying to remove the share from the computer? if anyone else is using any file from within that pipe, it will not let you delete the item unless you close the session. Edited November 3, 2005 by blademonkey ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung
fly Posted November 3, 2005 Author Posted November 3, 2005 Could you post the whole function to see if that gives some clues.Here it is. I write horrible code. expandcollapse popupFunc checkNullVars() MsgBox(0, "fdsa", "checkNullVars()") If Not GUICtrlRead($userCombo) Then; Check that an ID was selected SetError(1) Return("User ID not selected.") ElseIf GUICtrlRead($loadGroupY) = 1 Then; If 'load to new' is selected, check all this crap If Not GUICtrlRead($adminID) Then SetError(1) Return("Administrator ID not entered.") ElseIf Not GUICtrlRead($adminPass) Then SetError(1) Return("Administrator password not entered.") ElseIf Not GUICtrlRead($newPC) Then SetError(1) Return("New PC name not entered.") EndIf ElseIf FileExists($datastore & "\" & GUICtrlRead($userCombo)) Then $overwrite = MsgBox(20, "Uh-oh", "Directory already found for user. Overwrite?") If $overwrite = 6 Then ;MsgBox(0, "del", "deleting dir: |" & $datastore & "\" & GUICtrlRead($userCombo) & "|") ;DirRemove($datastore & "\" & GUICtrlRead($userCombo), 1) ;$vUserCombo = GUICtrlRead($userCombo) ;$datastore = "\\usmtserv1\backup$" ;DirRemove("\\usmtserv1\backup$\holmesz", 1) Dim $Dir2Rem ;$Dir2Rem = $datastore & "\" & GUICtrlRead($userCombo) $Dir2Rem = "U:\" & GUICtrlRead($userCombo) $test = DirRemove($Dir2Rem, 1) MsgBox(0, "fdsf", $test) Else MsgBox(0, "Well then...", "Please remove/rename existing datastore directory") EndIf Else; Everything checks out! SetError(0) Return("") EndIf EndFunc
bboysza Posted November 3, 2005 Posted November 3, 2005 Here it is. I write horrible code. expandcollapse popupFunc checkNullVars() MsgBox(0, "fdsa", "checkNullVars()") If Not GUICtrlRead($userCombo) Then; Check that an ID was selected SetError(1) Return("User ID not selected.") ElseIf GUICtrlRead($loadGroupY) = 1 Then; If 'load to new' is selected, check all this crap If Not GUICtrlRead($adminID) Then SetError(1) Return("Administrator ID not entered.") ElseIf Not GUICtrlRead($adminPass) Then SetError(1) Return("Administrator password not entered.") ElseIf Not GUICtrlRead($newPC) Then SetError(1) Return("New PC name not entered.") EndIf ElseIf FileExists($datastore & "\" & GUICtrlRead($userCombo)) Then $overwrite = MsgBox(20, "Uh-oh", "Directory already found for user. Overwrite?") If $overwrite = 6 Then ;MsgBox(0, "del", "deleting dir: |" & $datastore & "\" & GUICtrlRead($userCombo) & "|") ;DirRemove($datastore & "\" & GUICtrlRead($userCombo), 1) ;$vUserCombo = GUICtrlRead($userCombo) ;$datastore = "\\usmtserv1\backup$" ;DirRemove("\\usmtserv1\backup$\holmesz", 1) Dim $Dir2Rem ;$Dir2Rem = $datastore & "\" & GUICtrlRead($userCombo) $Dir2Rem = "U:\" & GUICtrlRead($userCombo) $test = DirRemove($Dir2Rem, 1) MsgBox(0, "fdsf", $test) Else MsgBox(0, "Well then...", "Please remove/rename existing datastore directory") EndIf Else; Everything checks out! SetError(0) Return("") EndIf EndFuncAh, I didn't even notice he was referencing a hiddenshare. It might not be so much a problem with the $ sign in the name, but perhaps how AutoIT works with the filesystem - which I'm not even sure how that is. Does DirRemove just send API's? I don't know, but one thing to try is to create another share for backup$ that isn't hidden. Ben
Developers Jos Posted November 3, 2005 Developers Posted November 3, 2005 (edited) Does DirRemove just send API's? I don't know, but one thing to try is to create another share for backup$ that isn't hidden. It uses the standard RemoveDirectory() function for none recursion directory deletion.It is using SHFileOperation for FIle& recursion deletion.Could it be that Hidden files are not deleted and thus the file isn't delete ?EDIT: updated Edited November 3, 2005 by JdeB 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.Â
fly Posted November 3, 2005 Author Posted November 3, 2005 (edited) Ah, I didn't even notice he was referencing a hiddenshare. It might not be so much a problem with the $ sign in the name, but perhaps how AutoIT works with the filesystem - which I'm not even sure how that is. Does DirRemove just send API's? I don't know, but one thing to try is to create another share for backup$ that isn't hidden.I tried it from another directory that wasn't behind a hidden share, and that deleted. Odd that it happens even if you map the hidden share, and that it only happens in a function...Would this qualify as a bug?edit: I didn't actually try the same directory, I tried to delete a folder in another directory from that function. I'll try resharing that backup$ directory tomorrow unhidden and give it a full test. Leaving for the day. Thanks for the help! Edited November 3, 2005 by fly
fly Posted November 4, 2005 Author Posted November 4, 2005 I tried it from another directory that wasn't behind a hidden share, and that deleted. Odd that it happens even if you map the hidden share, and that it only happens in a function...Would this qualify as a bug?edit: I didn't actually try the same directory, I tried to delete a folder in another directory from that function. I'll try resharing that backup$ directory tomorrow unhidden and give it a full test. Leaving for the day. Thanks for the help!Oooook.I have no idea what is going on here. I tried it from an unhidden share, and it still refuses to delete. I am using the beta, if that matters...
Nuffilein805 Posted November 4, 2005 Posted November 4, 2005 are you the only 1 using this dir?if there's just 1 more person using it it will refuse to be deleted!maybe you could try using dos to help younet use | more > test.txtto write it to a file who is using which application/folderthen you can check the file line by line if someone's using the folder you want to delete my little chatmy little encryption toolmy little hidermy unsafe clickbot
fly Posted November 4, 2005 Author Posted November 4, 2005 are you the only 1 using this dir?if there's just 1 more person using it it will refuse to be deleted!maybe you could try using dos to help youto write it to a file who is using which application/folderthen you can check the file line by line if someone's using the folder you want to deleteNope. No one is in it. Its my test server. And the return code is 1, so it thinks it deleted it...
Nuffilein805 Posted November 4, 2005 Posted November 4, 2005 as i see from your script (maybe i'm wrong) your returncode should be " " have you tried the *same* script on a different directory? i've seen you tried something on a different directory but was it that script? you said the dirremove works from outside the function (on that dir?) my little chatmy little encryption toolmy little hidermy unsafe clickbot
randallc Posted November 4, 2005 Posted November 4, 2005 Hi, I agree, there might be a bug here? Or is it still a compression or some other attribute setting upsetting it? Dos delete works on my same directory Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
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