Jump to content
Sign in to follow this  
Lunatic

Deleting a Folder

Recommended Posts

Lunatic

I'm in the process of creating addons for slipstreaming windows XP. In so doing, I'm attempting to create a script that will install Daemon Tools. Part of this installation process includes creating Start Menu Shortcuts. I've been able to delete the uninstall shortcut, rename the Dtools shortcut, and move it to the new folder. (Trying to keep the clutter out of my start menu). The issue comes when I try to remove the DAEMON Tools Lite folder from my start menu. I've researched this in the help file for Autoit, and after an hour (and 3 excedrin), I come for help.

I've been using these lines to make the attempt at folder deletion.

Started out with the simple "FileDelete" that I'd used to remove the uninstall.lnk, as seen below.

FileDelete ( @ProgramsCommonDir & "/DAEMON Tools Lite" )

This line did nothing. When I tweaked a little, I found it would empty out the folder, but not delete the folder its self.

When that failed to work, I researched the issue, and attempted the solution I found in the help file, as seen below.

DirRemove ( @ProgramsCommonDir & "/DAEMON Tools Lite" )

This gave me an error message, during the course of the script, the first time. I re-typed the line (which seems to have fixed a flaw somewhere), removing the error. However, this line still does not delete the file that I'm trying to clear from my start menu.

Thinking that maybe the program was having an issue finding the file, I attempted a longer address line. (I failed to include a drive letter because this will be put into a windows installation, and I can not be sure that the install will always be on C:/)

DirRemove ( "Documents and Settings\All Users\Start Menu\Programs\DAEMON Tools Lite" )

This line has a predictable result - it runs without error, but does nothing that I can see.

I have verified that the file folder I'm trying to delete is in the common programs folder for the start menu (as evidenced by the fact that the FileMove I use on the DAEMON Tools Lite.lnk shortcut works). I can't see where else I might be going wrong.. can anyone point me in the right direction?


[center][/center]

Share this post


Link to post
Share on other sites
MikeP

easy.. open up your start menu folder.. create a new directory and even links inside if you want.. then right-clic and check the properties..you'll see they're "read-only".. try unchecking that attribute..clic OK.. then check again.. Windows didn't do anything and they're still "read-only" .. no idea how to get rid off that but that's at least what's happening on my XPSP2..as Administrator. I'm pretty sure this is the cause of your problem.

maybe try with the DOS command attrib -r ... and that command to run DOS with Autoit :

Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)

Edited by MikeP

Share this post


Link to post
Share on other sites
Lunatic

I see your point on the read-only setting.

command line is a little above my understanding at this point, however, so I can't see how to set it for that specific folder.. ect. So, at this point I either need a simpler way to remove the read-only, or a breakdown on how to use that run line you put up.


[center][/center]

Share this post


Link to post
Share on other sites
MikeP

Nevermind the attribute changing to be able to use DirRemove.. just use the good old DOS no?

$fileToDel = FileGetShortName ("C:\Documents and Settings\All Users\Start Menu\Programs\DAEMON Tools Lite\")
Run(@ComSpec & " /c rmdir "& $fileToDel & "/s /q")

Btw I had no clue how to do that ..I just used Google and Search in this forum :)

Share this post


Link to post
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
Sign in to follow this  

×