Jump to content

DirRemove getting stuck...


Recommended Posts

Hello,

I have an install script which uses the "DirRemove" Function to clear a directory before installing to it. But it seems that from time to time the scripts stops while deleteing. Is there a possibility to check if the remove process was successfull and continue if so?

What I tried was the following:

$existiert = DirGetSize("c:\\Program Files (x86)")
if $existiert <> -1 then
$direxists= FileExists("C:\Program Files (x86)\Test")
if $direxists = 1 then
    $dirremove = DirRemove("C:\Program Files (x86)\Test",1)
EndIf
if DirRemove = 0 Then
    MsgBox ( 0, "", "fail" )
Else
    MsgBox (0, "", "success" )
endif

I tried to use "if DirRemove = 0 Then" to check but that doesn't help.

thank you

Felix

Link to comment
Share on other sites

Hello,

I have an install script which uses the "DirRemove" Function to clear a directory before installing to it. But it seems that from time to time the scripts stops while deleteing. Is there a possibility to check if the remove process was successfull and continue if so?

What I tried was the following:

$existiert = DirGetSize("c:\\Program Files (x86)")
if $existiert <> -1 then
$direxists= FileExists("C:\Program Files (x86)\Test")
if $direxists = 1 then
    $dirremove = DirRemove("C:\Program Files (x86)\Test",1)
EndIf
if DirRemove = 0 Then
    MsgBox ( 0, "", "fail" )
Else
    MsgBox (0, "", "success" )
endif

I tried to use "if DirRemove = 0 Then" to check but that doesn't help.

thank you

Felix

You're missing the "$" in your If statement. It should be:

if $dirremove = 0 Then
    MsgBox ( 0, "", "fail" )
Else
    MsgBox (0, "", "success" )
endif

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

suppose that works too -.-'

Yep :) Just another example to drive home why your variables should never have the same name as a built-in function.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Yep :) Just another example to drive home why your variables should never have the same name as a built-in function.

I read over it, but I didn't really pay that much attention, I just saw alot of code that wasn't necessary
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

You can straighten up that code a lot with the following

If DirGetSize("c:\Program Files (x86)") <> -1 then
   If FileExists("C:Program Files (x86)Test") Then
      If DirRemove("C:Program Files (x86)Test",1) Then
         MsgBox (0, "", "success" )
      Else
         MsgBox ( 0, "", "fail" )
      EndIf
   Endif
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

You can straighten up that code a lot with the following

If DirGetSize("c:\Program Files (x86)") <> -1 then
   If FileExists("C:Program Files (x86)Test") Then
      If DirRemove("C:Program Files (x86)Test",1) Then
         MsgBox (0, "", "success" )
      Else
         MsgBox ( 0, "", "fail" )
      EndIf
   Endif
EndIf
yup, I just wrote it quickly, I didnt use scite or I'd of used tidy, sorry haha
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

yup, I just wrote it quickly, I didnt use scite or I'd of used tidy, sorry haha

I wasn't refering to Tidy. I was refering to the use of variables that were not required.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...