DeleteFolder and DeleteFile Results

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
unclejoe
Newbie
Posts: 14
Joined: Wed Nov 06, 2002 10:43 am
Location: Poughkeepsie, NY

DeleteFolder and DeleteFile Results

Post by unclejoe » Sat Jan 30, 2010 3:11 pm

I have a macro where I am deleting certain files and folders. I have run into a problem when the file/folder cannot be deleted due to being protected or in use. How can I determine if the operation was successful, or if not, how do I determine why?.
Joe Mueller
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jan 30, 2010 5:27 pm

After the Delete operation do IfDirExists> or IfFileExists>. You may want to use a Wait> command after the Delete to allow time before checking if it was done.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

unclejoe
Newbie
Posts: 14
Joined: Wed Nov 06, 2002 10:43 am
Location: Poughkeepsie, NY

Post by unclejoe » Sun Jan 31, 2010 3:02 am

Sounds like a good suggestion.

I was hoping that there was some way to capture the error message or error code so I could report it.

Thanks.
Joe Mueller
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Jan 31, 2010 3:24 am

If a code existed you would be checking for a code and making an IF condition action.

These commands are the same thing. The commands result in IF condition actions also. (But no need to remember a code number). If you need a code, maybe for other actions, just assign your own code as part of the IF actions.

Sample code draft:

Code: Select all

Delete File
Wait
If File Exists, True, False

Label>True
Let>DeletedCode=0
Do something like two more delete attempts.

Label>False
Let>DeletedCode=1
Do something else
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts