I use the CLI version of PHP on Windows Vista. Here's how to determine if a file is marked "hidden" by NTFS:
<?php
function is_hidden_file($fn) {
$attr = trim(exec('FOR %A IN ("'.$fn.'") DO @ECHO %~aA'));
if($attr[3] === 'h')
return true;
return false;
}
?>
Changing <?php if($attr[3] === 'h') ?> to <?php if($attr[4] === 's') ?> will check for system files.
This should work on any Windows OS that provides DOS shell commands.
filetype
(PHP 4, PHP 5)
filetype — Liefert den Typ einer Datei
Beschreibung
string filetype
( string $filename
)
Gibt den Typ einer Datei zurück. Mögliche Werte sind fifo, char, dir, block, link, file und unknown.
Gibt FALSE zurück, wenn ein Fehler auftrat. filetype() erzeugt auch eine E_NOTICE Meldung, wenn der stat-Aufruf fehlschlägt oder der Dateityp ubekannt ist.
Das Ergebnis dieses Funktionsaufrufes wird zwischengespeichert. Siehe clearstatcache() für weitere Einzelheiten.
Diese Funktion ist nicht für remote Dateien geeignet, die zu prüfende Datei muss über das Dateisystem des Servers verfügbar sein.
Siehe auch: is_dir(), is_file(), is_link(), file_exists() und stat().
filetype
7r6ivyeo at mail dot com
22-Nov-2008 01:29
22-Nov-2008 01:29
ruach at chpc dot utah dot edu
11-Mar-2004 01:11
11-Mar-2004 01:11
There are 7 values that can be returned. Here is a list of them and what each one means
block: block special device
char: character special device
dir: directory
fifo: FIFO (named pipe)
file: regular file
link: symbolic link
unknown: unknown file type
