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 — Pobiera typ pliku
Opis
Zwraca typ pliku. Możliwe wartości to fifo, char, dir, block, link, file i unknown.
Zwraca FALSE jeśli wystąpił błąd. filetype() również utworzy wiadomość E_NOTICE jeśli wywołanie stat się nie powiedzie lub gdy plik ma tym nieznany (unknown).
Informacja: Wyniki działania tej funkcji są buforowane. Zobacz opis funkcji clearstatcache() aby uzyskać więcej informacji.
Od PHP 5.0.0 ta funkcja może być użyta także z niektórymi nakładkami URL. Zobacz List of Supported Protocols/Wrappers aby uzyskać listę nakładek, które obsługują funkcjonalność z rodziny stat().
Przykład #1 filetype() przykład
<?php
echo filetype('/etc/passwd'); // plik
echo filetype('/etc/'); // katalog
?>
Patrz także: is_dir(), is_file(), is_link(), file_exists(), stat() i mime_content_type().
filetype
22-Nov-2008 01:29
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
