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 — Leest het type van een bestand uit
Beschrijving
string filetype
( string $filename
)
Geeft het type van het bestand terug. Mogelijke waardes zijn fifo, char, dir, block, link, file en unknown.
Geeft FALSE terug in het geval van een fout. filetype() zal ook een E_NOTICE bericht produceren als de stats aanroep faalt of als het bestands type onbekend is.
Note: The results of this function are cached. See clearstatcache() for more details.
Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.
Example#1 filetype() voorbeeld
<?php
echo filetype('/etc/passwd'); // file
echo filetype('/etc/'); // dir
?>
Zie ook is_dir(), is_file(), is_link(), file_exists(), stat() en mime_content_type().
filetype
7r6ivyeo at mail dot com
22-Nov-2008 02:29
22-Nov-2008 02:29
ruach at chpc dot utah dot edu
11-Mar-2004 02:11
11-Mar-2004 02: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
