Sign in to follow this  
Followers 0
koalaz2004

Is There A Way To Make A Script Delete Old Files?

9 posts in this topic

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

Share this post


Link to post
Share on other sites



it would be realllly easy if they were all in a certain folder but give me a sec

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

$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

this is the same ... :think:

$path = FileSelectFolder("Select a Folder to search","C:\")
$file1 = "*.bk"
FileDelete($Path & "\" & $file1)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

oops my bad :think:

Share this post


Link to post
Share on other sites

Wow guys that was fast thanks for the help

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

edit: oops didnt see you post there thought you didnt get it :think:

$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 by thatsgreat2345

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