Jump to content
Sign in to follow this  

Folder Recall?

Recommended Posts


Is it possible to do this?

The program will read the folder then you click a button or something then if the folder was changed in any way (like a file was added to it, it would delete that file) it would 'recall' the folder; reverting the folder back to how it was before.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post

Link to post
Share on other sites

For what purpose?

It would be easy to just make a copy of the folder, and periodically delete the original and replace it with the backup. You could use a zipped copy of it for instance.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post

Link to post
Share on other sites

So, I'm still new to autoit, but I thought I'd take a stab at this for a personal exercise - so no laughing. :P

#include <Array.au3>
#include <File.au3>

Dim $file_list = @ScriptDir & "\allowed.txt"  ;list containing allowed files
Dim $allowed_list[1] = [0]
Dim $read_list[1] = [0]
Dim $delete_list[1] = [0]

$line_count = _FileCountLines($file_list)
$allowed_list[0] = $line_count

For $i = 1 To $line_count
    _ArrayAdd($allowed_list, FileReadLine($file_list, $i))

;_ArrayDisplay($allowed_list, "Allowed")  ;display current allowed list

Dim $start = FileFindFirstFile("c:\temp\*.*")  ;directory to search
Dim $x = 0
While 1
    Local $found = FileFindNextFile($start)
    If @error Then ExitLoop
    If Not $found = StringInStr($found, ".") Then ContinueLoop  ;check for a "." to verify not a folder
    _ArrayAdd($read_list, $found)
    $x = $x + 1
$read_list[0] = $x

;_ArrayDisplay($read_list, "Read")  ;display all files read

For $i = 1 To $read_list[0]
    Local $search = $read_list[$i]
    Local $found = _ArraySearch($allowed_list, $read_list[$i])
    If @error Then
        _ArrayAdd($delete_list, "c:\temp\" & $read_list[$i])
        $delete_list[0] = 1 + $delete_list[0]

;_ArrayDisplay($delete_list, "Delete")  ;display files that need deleting

For $i = 1 To $delete_list[0]
    MsgBox(0, "Delete this", $delete_list[$i])
    ;do something to the $delete[$i} file
Edited by xcal

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.