Jump to content

Folder Recall?


Skrip
 Share

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]

Link to comment
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))
Next

;_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
WEnd
$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]
    EndIf
Next

;_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
Next
Edited by xcal
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...