Sign in to follow this  
Followers 0
caspermurphy

Deleting Files

8 posts in this topic

I am trying to delete files off of a desktop

I have tried the following:

FileDelete, C:\Documents and Settings\\%USERPROFILE%\\Desktop\\1.text, 0

changing the txt to a wild card and the 1 to a wildcard with the .txt extension also 0 to a 1 (what does that do anyway?)

I have also tried it this way

FileDelete, C:\Documents and Settings\userid\Desktop\1.txt, 0

Any ideas what I am doing wrong?

Thanks for your help.

John

Share this post


Link to post
Share on other sites



Since you posted in the version 3 forum, try this:

FileDelete("C:\Documents and Settings\userid\Desktop\1.txt")

Another consideration is whether the file is "in-use." For Windows XP, I've had lots of trouble with folders I've simply browsed and closed being classifed "in use" by explorer. Killing and restarting explorer.exe allowed me to delete the file.


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

You can also use :

FileDelete(@DesktopDir & "1.txt") for the current user's Desktop or

FileDelete(@DesktopCommonDir & "1.txt") for the common (All User's) Desktop


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites

What I want to do is to be able to delete files on each person’s PC. These files on each person’s desktop. Each person will execute this on their own PC. We are using windows 2000 professional.

The path to the files is

C:\Documents and Settings\userid\Desktop\1.txt")

Where userid is different for everyone, I assume that I am able to use the %USERPROFILE%. I have tried it just using my own userid and it does not work.

I have tried these:

FileDelete ("C:\Documents and Settings\bcajpk\Desktop\1.txt")

FileDelete(@DesktopCommonDir & "1.txt")

FileDelete(@DesktopDir & "1.txt")

I get the error Unknown command.

Am I better off using v2 or v3?

Thank you everyone for your help.

Share this post


Link to post
Share on other sites

Larry,

neither of those worked, I get the error message "Error: Unknown command"

Does it matter if there is a , after FileDelete?

I put one there I don't get a error message but the file isn't deleted either.

Sorry to be a pain

John

Share this post


Link to post
Share on other sites

Larry,

I am using Autoit 3.

I ca use ver 2 if need be.

John

Share this post


Link to post
Share on other sites

Larry,

Thanks version 2 works just fine.

Thanks again

John :whistle:

Share this post


Link to post
Share on other sites

UP

Goodbye, good luck and get a life.

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!"

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  
Followers 0