PRODUCT |

|

|
|
|

|
|
|
|
|
|
|
|
|
FAQ |
|
|

|
|
|
|
|
|
|
|
|
|
LEARN SCRIPTING |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE SCRIPTS |
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HELP / DOCUMENTATION |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
Help Page - fdinfo
( Some help pages may not display correctly in html because those help pages may have sample code in them, part of which may be mis-interpreted as html tags.
All help pages, including this help page, are available in biterScripting with the help command. )
|
|
|
Command
fdinfo
Purpose
Shows information on one file or directory.
Aliases
fdinfo, fdi, accessfile, accfile, afi, af
Syntax
fdinfo [<options>] <filedir>
Options
-s List size in bytes.
-t List type as file or directory.
-m List latest modification time.
-a List latest access time.
-c List creation time.
-n List name.
If no options are specified, everything is listed.
Arguments
<filedir>
The name or path of a file or directory, information on which is sought.
Path can be relative or absolute. Name patterns are NOT allowed.
(With name patterns, use the lf or mf commands instead.)
We recommend using double quotes around <filedir>, because many
files and directories have spaces and other special characters
in their names.
Stream Input
Ignored.
Stream Output
The various file or directory information items are listed on one line in the following order.
Items are separated by tabs.
size
type
latest modification time
latest access time
creation time
name
Stream Error
Any errors are listed here.
Description
This command accesses information on the specified file or directory.
In addition to displaying the listing in stream output, it sets values for
several system variables, which then can be used to do further processing of
the file.
If the specified <filedir> is found, information about the file or directory is made
available in the following system variables. Please note that all of these
variables are set irrespective of which options are specified. The options
merely dictate the format of the output listing.
$fexists true if file/directory exists, false otherwise.
$fname File/directory name.
$ftype File/directory type. Can be one of the following.
f Flat file
d Directory
o Other
$fatime Latest access time.
$fctime Creation time.
$fmtime Latest modification time.
All times are in the
format - yyyymmddhhMMss.
The lower case mm is month. The upper case MM is
minute. The hour (hh) is in 24 hour format.
$fsize File size in bytes.
If the specified <filedir> is not found, or if an error occurs, $fexists is set to false.
All other system variables retain their previous values.
Restrictions
If the file size is too large and can not be contained in the variable
of type int, the displayed (and assigned to $fsize) size will be incorrect.
The sizes of directories are meaningless. So, they are always shown as 0 (zero).
Security and other restrictions placed by the operating system may
result in not being able to access certain files and directories.
Valid Examples
The following example shows if a file has been modified in the current year.
We use >null in the output of the fdinfo command, because we don't want to see
the file listing, we only want to compare its modification time by accessing
that value in $fmtime.
var str currentYear
set $currentYear= { chex "4]" gettime() }
fdinfo "mypage.html" >null
if ($fmtime > $currentYear)
echo "File mypage.html has been edited in current year."
else
echo "File mypage.html has NOT been edited in current year."
endif
The following example finds the file or directory that was modified the last in
the directory "C:/myproject" .
var str lastModifiedFile
var str latestTime
var str fileList
lf -rn "*" "C:/myproject" >$fileList
var str oneFile
lex "1" $fileList >$oneFile # Get first file in the list.
while ($oneFile <> "")
do
fdinfo $oneFile >null
if ($fmtime > $latestTime)
do
set $lastModifiedFile = $fname
set $latestTime = $fmtime
done
endif
lex "1" $fileList >$oneFile # Get next file in the list.
done
echo "Last modified file or directory: " $lastModifiedFile ", Modification time: " $latestTime
If you wish not to see directories and want to list only flat files, you can do one
of the following things.
- Add the condition ($ftype=="f") in the lf command.
- Check if ($ftype=="f") after calling the fdinfo command.
Invalid Examples
fdinfo "*.txt"
Will produce an error. Patterns are not allowed in this command.
See Also
fdset
lf
mf
var
systemvar
|
|
|
© 2008-2012, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|
|