-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateFile.au3
More file actions
104 lines (97 loc) · 2.67 KB
/
CreateFile.au3
File metadata and controls
104 lines (97 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <Date.au3>
#Include <Array.au3>
#Include <file.au3>
; Add 5 days to today
;~ $sNewDate = _DateAdd( 'd',5, _NowCalcDate())
;~ $TimeStr = _NowDate()
;~ $sNewDate = _DateAdd( 'd',1,_NowCalcDate())
;~ $sNewDate = StringReplace($TimeStr, ".", "")
;~ MsgBox( 4096, "", $sNewDate)
;~ $t=FileGetTime("C:\Temp\log.txt", 1)
;~ If Not @error Then
;~ $yyyymd = $t[0] & "/" & $t[1] & "/" & $t[2]
;~ MsgBox(0, "Creation date of notepad.exe", $yyyymd)
;~ EndIf
;~ Exit
$DateStart=_DateAdd( 'd',-36,_NowCalcDate())
For $i =1 to 36
$Testfile = FileOpen("C:\Temp\PlanB_" & StringReplace($DateStart, "/", "") & ".001", 1)
FileClose($Testfile)
$var = FileSetTime("C:\Temp\PlanB_" & StringReplace($DateStart, "/", "") & ".001", StringReplace($DateStart, "/", "") ,1)
$DateStart=_DateAdd( 'd',1,$DateStart)
Next
Exit
;~ $var = FileSetTime("file.au3", "20031101",1)
$SizeDT=GetCountFilesDT("C:\Temp\samara*.dt")
Dim $arrayDT[$SizeDT][3]
$search = FileFindFirstFile("C:\Temp\samara*.dt")
If $search = -1 Then
;~ MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
$NS=0;
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
;~ * MsgBox(4096, "File:", $file)
$t=FileGetTime("C:\Temp\" & $file, 1)
If Not @error Then
$yyyymd = $t[0] & "/" & $t[1] & "/" & $t[2]
;~ MsgBox(0, "Creation date of notepad.exe", $yyyymd)
EndIf
$arrayDT[$NS][0]=$yyyymd
$arrayDT[$NS][1]="C:\Temp\" & $file
;~ MsgBox(0,"",$yyyymd)
;~ MsgBox(0,"",_DateToDayOfWeek ($t[0] , $t[1], $t[2]))
;~ Exit
if _DateToDayOfWeek ($t[0] , $t[1], $t[2]) =1 then
$arrayDT[$NS][2]=True
Else
$arrayDT[$NS][2]=false
EndIf
$NS=$NS+1
WEnd
;~ Exit
; Close the search handle
FileClose($search)
_ArraySort($arrayDT, 1 , 0, 0, 0)
;~ _ArrayDisplay($arrayDT, "$avArray as a list classes in window")
;~ Exit
$MaxKolvoVoskr=4
$NVoskr=0
$SevenDayEarly=_DateAdd( 'd',-7,_NowCalcDate())
For $i = 0 to $SizeDT -1
;~ MsgBox(0,"",$arrayDT[$i][0])
;~ MsgBox(0,"",$SevenDayEarly)
;~ Exit
$FileDelete=False
if $SevenDayEarly > $arrayDT[$i][0] Then
if $arrayDT[$i][2] Then
$NVoskr=$NVoskr+1
;~ MsgBox(0,"",$NVoskr & "-" & $arrayDT[$i][1])
If $NVoskr>4 Then
$FileDelete=True
EndIf
Else
$FileDelete=True
EndIf
EndIf
if $FileDelete Then
FileDelete($arrayDT[$i][1])
EndIf
Next
Func GetCountFilesDT($StrSearch)
$CountOfDT=0;
$search = FileFindFirstFile($StrSearch)
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)
$CountOfDT=$CountOfDT+1
WEnd
Return $CountOfDT
EndFunc