koalaz2004 Posted April 15, 2006 Share Posted April 15, 2006 Im backing up server info and the old bakups take a tun of time to delete and there just simple files , but I wanted o know is there a script I could use to delete old .bk files? or just delete files? Thanks also is there a way to rename files too? Thanks Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 15, 2006 Share Posted April 15, 2006 it would be realllly easy if they were all in a certain folder but give me a sec Link to comment Share on other sites More sharing options...
Simucal Posted April 15, 2006 Share Posted April 15, 2006 Check FileMove() in the help file for renaming.. you effectively overwrite the files with themselves and their new name if I understand correctly. Also check out, FileDelete(), DirRemove(), FileRecyle(), etc AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 15, 2006 Developers Share Posted April 15, 2006 Here is a script example that can delete files older than and remove empty directories i posted a while ago... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 15, 2006 Share Posted April 15, 2006 $path = FileSelectFolder("Select a Folder to search","C:\") $file1 = "*.bk" $search = FileFindFirstFile($path & $file1) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) filedelete($file) WEnd ; Close the search handle FileClose($search) that might work Link to comment Share on other sites More sharing options...
Developers Jos Posted April 15, 2006 Developers Share Posted April 15, 2006 $path = FileSelectFolder("Select a Folder to search","C:\") $file1 = "*.bk" $search = FileFindFirstFile($path & $file1) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) filedelete($file) WEnd ; Close the search handle FileClose($search) that might workthis is the same ... $path = FileSelectFolder("Select a Folder to search","C:\") $file1 = "*.bk" FileDelete($Path & "\" & $file1) SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 15, 2006 Share Posted April 15, 2006 oops my bad Link to comment Share on other sites More sharing options...
koalaz2004 Posted April 15, 2006 Author Share Posted April 15, 2006 Wow guys that was fast thanks for the help Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 15, 2006 Share Posted April 15, 2006 (edited) edit: oops didnt see you post there thought you didnt get it $path = FileSelectFolder("Select a Folder to search","C:\") $file1 = "*.bk" FileDelete($Path & "\" & $file1) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) filedelete($file) WEnd ; Close the search handle FileClose($search) Edited April 15, 2006 by thatsgreat2345 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