AutoIt.@ - Hilfe
FileGetAttrib
Gibt einen String zurück, Code die Attribute einer Datei beinhaltet.
Parameter
| Parameter | Typ | Standardwert | Beschreibung |
| $Dateiname | string (Zeichenkette) | | Dateiname (Oder Verzeichnis) zu überprüfen. |
Rückgabewert
| Bei Erfolg: |
Gibt einen String Code zurück, der die Attribute beinhaltet. |
| Bei Fehler: |
Gibt "" (leere Zeichenfolge)zurück, und setzt @ error auf 1. |
Bemerkung
Gibt einen String zurück, dass folgende Buchstaben beinhalten kann ("RASHNDOCT"):
"R" = Nur Lesender Zugriff
"A" = Archiv
"S" = Systemdatei
"H" = Versteckt
"N" = NORMAL
"D" = VERZEICHNIS
"O" = Offline
"C" = Komprimiert (NTFS-Komprimierung, keine ZIP-Komprimierung)
"T" = TEMPORARY
Beispiel
$attrib = FileGetAttrib("c:\boot.ini")
If @error Then
MsgBox(4096,"Error", "Konnte Attribute nicht auslesen.")
Exit
Else
If StringInStr($attrib, "R") Then
MsgBox(4096,"", "Nur Lesender Zugriff auf dieser Datei!")
EndIf
EndIf
; Zeigt volle Attribut-Informationen in Textform an
$input = StringSplit("R,A,S,H,N,D,O,C,T",",")
$output = StringSplit("Read-only /, Archive /, System /, Hidden /" & _
", Normal /, Directory /, Offline /, Compressed /, Temporary /", ",")
For $i = 1 to 9
$attrib = StringReplace($attrib, $input[$i], $output[$i], 0, 1)
; last parameter in StringReplace means case-sensitivity
Next
$attrib = StringTrimRight($attrib, 2) ;remove trailing slash
MsgBox(0,"Full file attributes:", $attrib)
$attrib = FileGetAttrib("c:boot.ini")
If @error Then
MsgBox(4096,"Error", "Konnte Attribute nicht auslesen.")
Exit
Else
If StringInStr($attrib, "R") Then
MsgBox(4096,"", "Nur Lesender Zugriff auf dieser Datei!")
EndIf
EndIf
; Zeigt volle Attribut-Informationen in Textform an
$input = StringSplit("R,A,S,H,N,D,O,C,T",",")
$output = StringSplit("Read-only /, Archive /, System /, Hidden /" & _
", Normal /, Directory /, Offline /, Compressed /, Temporary /", ",")
For $i = 1 to 9
$attrib = StringReplace($attrib, $input[$i], $output[$i], 0, 1)
; last parameter in StringReplace means case-sensitivity
Next
$attrib = StringTrimRight($attrib, 2) ;remove trailing slash
MsgBox(0,"Full file attributes:", $attrib)