Difference between revisions of "$exists"
From Scriptwiki
m (dimdim) |
m ($exists + $isfile + $isdir) |
||
Line 1: | Line 1: | ||
− | $exists(file/ | + | '''$isfile(file) / $isdir(directory) / $exists(file/directory)''' |
− | Returns $true | + | Returns informations on whether or not a file/directory exists. |
− | $exists( | + | |
+ | $isfile($mircdir $+ mirc.ini) // returns $true (is a file) | ||
+ | $isfile($mircdir) // returns $false (is a directory) | ||
+ | $isdir($mircdir $+ mirc.ini) // returns $false (is a file) | ||
+ | $isdir($mircdir) // returns $true (is a directory) | ||
+ | $exists($mircdir $+ mirc.ini) // returns $true (is a file) | ||
+ | $exists($mircdir) // returns $true (is a directory) | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | $isfile | ||
+ | alias file_exists { | ||
+ | if ($isfile($1)) { return file exists! } | ||
+ | else { return file doesn't exist } | ||
+ | } | ||
+ | |||
+ | $isdir | ||
+ | alias dir_exists { | ||
+ | if ($isdir($1)) { return directory exists! } | ||
+ | else { return directory doesn't exist } | ||
+ | } | ||
+ | |||
+ | $exists | ||
+ | alias file_dir_exists { | ||
+ | if ($exists($1)) { return file/directory exists! } | ||
+ | else { return file/directory doesn't exist } | ||
+ | } | ||
+ | |||
+ | [[Category:File and Directory Identifiers]] |
Revision as of 09:25, 18 May 2007
$isfile(file) / $isdir(directory) / $exists(file/directory)
Returns informations on whether or not a file/directory exists.
$isfile($mircdir $+ mirc.ini) // returns $true (is a file) $isfile($mircdir) // returns $false (is a directory) $isdir($mircdir $+ mirc.ini) // returns $false (is a file) $isdir($mircdir) // returns $true (is a directory) $exists($mircdir $+ mirc.ini) // returns $true (is a file) $exists($mircdir) // returns $true (is a directory)
Examples
$isfile
alias file_exists { if ($isfile($1)) { return file exists! } else { return file doesn't exist } }
$isdir
alias dir_exists { if ($isdir($1)) { return directory exists! } else { return directory doesn't exist } }
$exists
alias file_dir_exists { if ($exists($1)) { return file/directory exists! } else { return file/directory doesn't exist } }