PDA

View Full Version : Stupid trouble with deleting


mangomel
09-24-2006, 04:57 PM
Are there any restrictions with deleting some files from system folders? Because I can't delete any files from C:\WINDOWS folder.
I cerated a new project to check if it really does't work and put this script into button object:

bdb = "Do you really want to delete those temporary files?"
question1 = Dialog.Message("Confirmation", bdb, MB_OKCANCEL, MB_ICONQUESTION, MB_DEFBUTTON1);

if proceed == IDOK then
StatusDlg.Show(MB_ICONNONE, true);
StatusDlg.SetTitle("Deleting");
StatusDlg.ShowProgressMeter(true);
StatusDlg.ShowCancelButton(true, "Stop");

File.Delete("C:\\WINDOWS\\*.bak", true, false, true, nil);
StatusDlg.Hide(MB_ICONNONE, true);

end

DjArko85
09-24-2006, 06:24 PM
I don't know if is your case; but I know that the function: File.Delete don't works if windows is using that files, and i didn't find a way to close that files.

Intrigued
09-24-2006, 08:11 PM
Tip:

You can download UNLOCKER (http://ccollomb.free.fr/unlocker/). Here is a quote from the creator's Website:

Unlocker is completely free and will always remain free, which means you can use it free of charge for any purposes...

...- Can Unlocker be run in command line? Yes! Unlocker -H for command line options...

Now, you can install this (great resource as I posted before) it onto your system. Then copy the unlocker.exe to your AMS project. Now you are ready to call it via command-line. If you call Unlocker with Unlocker -H would see the following:

(see attachment)

Intrigued
09-24-2006, 08:35 PM
I have not tried this so let me know how you all turn out with this approach. Maybe one wiser than me can find a way via UnlockFileEx?

mangomel
09-25-2006, 05:29 AM
I use Unlocker since year, but thanks for advice. It's very useful program.

But I'm afraid, those dat files were not in use :). For example, I copied into that directory RAR archive and I changed it extesion to *.dat. And I tried to delete any other file types like *.bmp etc. but my app didn't work...

Now I think, I'd betted reinstall Autoplay MS or even whole Windows, because I really don't believe, that it's normal AMS behavior. And then I'll see.

Intrigued
09-25-2006, 08:50 AM
Ah, okay, let me know how it works out.

Roboblue
09-25-2006, 01:26 PM
Intrigued
Thanx for this link.
For over a year, I have had 3 empty folders on one one of my drives that couldn't be deleted. This got rid of them.
As far as mangomel's problem, it sounds like admin priveliges for the User hasn't been set correctly. If going into User Accounts (Control Panel) and making sure the User's Admin permissions is set doesn't help, a re-install of Windows is probably the best bet.
I re-install XP at least once a year. By that time, something is corrupted or the system is bloated so bad it has started to irritate me. I also try to keep my important stuff backed up on DVD and another hard drive. I also Ghost each install when I do them just in case. Another thing I do is set all my program save defaults to a separate drive or partition in case the OS goes bust, I won't lose that data. I can just Ghost the system drive and go on.
Like any important relationship, work PC's are hard work to maintain.