Roman Posted August 21, 2006 Share Posted August 21, 2006 Hi I want to delete a file, e.g. with Filename "abc" (no extension). If i use FileDelete("c:\abc") that works. But: if there exists a directoy c:\abc instead of a file, the same command deletes me the content of that directory(!) How can i be sure to delete only a file, but never a directory (-content) with the same name? Sure, i could use FileDelete("c:\abc*") but that deletes me all files, beginning with "abc...". Greetings, Roman. Link to comment Share on other sites More sharing options...
Markus Posted August 21, 2006 Share Posted August 21, 2006 Try this: FileDelete("D:\abc.*") "It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output Link to comment Share on other sites More sharing options...
Roman Posted August 21, 2006 Author Share Posted August 21, 2006 Try this: FileDelete("D:\abc.*") Hm.. Yes that works, but it deletes me the file "abc" with every extension, abc.txt, abc.doc and so on. I want to by sure to touch only the file "abc". No more and not less. Link to comment Share on other sites More sharing options...
MHz Posted August 21, 2006 Share Posted August 21, 2006 Use this to tell the difference If Not StringInStr(FileGetAttrib('c:\abc'), 'D') Then FileDelete('c:\abc') EndIf Link to comment Share on other sites More sharing options...
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