Shawndt Posted February 18, 2010 Posted February 18, 2010 I've noticed that I cannot delete read-only files with FILEDELETE. Is there away too get around this?
Steveiwonder Posted February 18, 2010 Posted February 18, 2010 (edited) #include <Process.au3> _RunDOS ( "DEL ""C:\1.txt""" )Untested Edited February 18, 2010 by Steveiwonder They call me MrRegExpMan
Shawndt Posted February 18, 2010 Author Posted February 18, 2010 #include <Process.au3> _RunDOS ( "DEL ""C:\1.txt""" ) Untested The include file, does it have to be on the machine or when you create the .exe file?
somdcomputerguy Posted February 18, 2010 Posted February 18, 2010 It has to be on the machine when you create the exe, but it doesn't need to be with the exe after it's created. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
kaotkbliss Posted February 18, 2010 Posted February 18, 2010 should already be on the machine (unpacked in the include folder when autoit installed) just make sure to add that line to the top of your code if you use the _RunDOS function 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
Danny35d Posted February 18, 2010 Posted February 18, 2010 Try it:$sFileToDelete = @DesktopDir & '\DeleteReadOnlyFile.txt' If StringInStr(FileGetAttrib($sFileToDelete), 'R') Then FileSetAttrib($sFileToDelete, '-R') $iRet = FileDelete($sFileToDelete) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Shawndt Posted February 19, 2010 Author Posted February 19, 2010 Try it:$sFileToDelete = @DesktopDir & '\DeleteReadOnlyFile.txt' If StringInStr(FileGetAttrib($sFileToDelete), 'R') Then FileSetAttrib($sFileToDelete, '-R') $iRet = FileDelete($sFileToDelete) Danny, thanks so much for your help. Got another question. I am checking to see if a fileexist which is simply but i cannot find the Syntax to Check for Directory?
kaotkbliss Posted February 19, 2010 Posted February 19, 2010 you can use FileExists to check for files and foldersFileExists ( "path" ) ParametersPath The directory or file to check. Return ValueSuccess: Returns 1. Failure: Returns 0 if path/file does not exist. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now