Hallo,
ich bin hier neu und habe ich auch keine große erfahrung mit AutoIt, aber finde ich ihm Super.
Meine Problem:
Ich möchte aus ein Ordner Datei die sind älter als 3 oder 2 Tage verschieben in andere Ordner, dabei sollte ein ZIP Datei erstellen nach Jahr \ Monat (wenn ist nicht da) und rein (in "MonatsZIP" zB. Ordner:2006, ZIP: 02.zip) einfügen. Und wenn ist ZIP-Datei da (zB. 02.zip) sollte ihm nicht überschreiben sonder öffnen und rein Neu Datei einfügen.
Ich habe kleines script gefunden, die die Datei aus ein Ordner verschiebt nach andere datei gleichzeitig erstelt Odrner mit JJJJ \ MM aber mit ZIP funktion komme ich nicht klar.
Hat jemand Idee, ich bin sehr dankbar.
[autoit]
#include <Date.au3>
#include <file.au3>
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
$quellpfad = $CmdLine[1]
$zielpfad = $CmdLine[2]
$anztage = $CmdLine[3]
$CurrentDirectory = FileChangeDir($quellpfad) ; Changes the current working directory to the one needed
; MsgBox(0, "", "Current Working Directory: " & @WORKINGDIR) ; Used for viewing the output of variable
$TodaysDateIs = (@YEAR & "/" & @MON & "/" & @MDAY) ; Sets up the date format for calculation, must use Year, month, day format
[/autoit][autoit][/autoit][autoit]; MsgBox(0, "", "The Date is: " & $TodaysDateIs ) ; Used for viewing the output of variable
[/autoit][autoit][/autoit][autoit][/autoit][autoit]; Shows the filenames of all files in the current directory, note that "." and ".." are returned.
$search = FileFindFirstFile("*")
; 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
If $file = "." Then ContinueLoop ; Blocks output of the root directory "."
If $file = ".." Then ContinueLoop ; Blocks output of the current directory ".."
$FileDate = FileGetTime($file, 0, 0)
; MsgBox(0, "File Date is: ", $FileDate)
; MsgBox(0, "File Name is: ", $file)
If Not @error then
$yyyymmdd = $FileDate[0] & "/" & $FileDate[1] & "/" & $FileDate[2]
$jahr = Stringmid($yyyymmdd,1,4)
$monat = Stringmid($yyyymmdd,6,2)
;MsgBox(0, "Monat:", $monat)
;MsgBox(0, "File Date is", $yyyymmdd)
EndIf
$DateDiffTotal = _DateDiff( 'D',$yyyymmdd,$TodaysDateIs)
[/autoit][autoit][/autoit][autoit]If $DateDiffTotal > $anztage Then
DirCreate($zielpfad & "" & $jahr & "" & $monat)
FileMove($file, $zielpfad & "" & $jahr & "" & $monat)
EndIf
[/autoit][autoit][/autoit][autoit][/autoit][autoit]WEnd
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]; Close the search handle
FileClose($search)
PS....
Ich starte dieser Script per Batch-Datei:
echo off
echo Programm 1
start /wait C:\1_archiv.exe c:\d\archiv c:\d\sen\archiv 1
Hab mal die ["CODE"] Tags gesetzt. Zum besseren lesen. Gun-Food
Hab mal die ["AutoIt] Tage gesetzt. Zum noch besseren lesen. Schließlich hat Gun-Food die eingebaut ;).
peethebee