PRODUCT |

|

|
|

|
|
|
|
|
FAQ |
|

|
|
|
|
|
|
LEARN SCRIPTING |
|

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

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

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

|
|
|
|
|
Help Page - SS_ListFiles
( 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. )
|
|
Sample Script
SS_ListFiles
Purpose
Lists file names matching a given pattern in a given directory.
Source Code
#####################################################################
# SCRIPT: SS_ListFiles
#
# This script lists files whose names match a given criterion in a given directory.
#
# The criterion for file names is assigned using FVA (Forward Variable Assignment)
# for str variable $files. The value of $files is of form
# "*.cpp" .
#
# The directory name is assigned using FVA
# for str variable $dir. The value of $dir is of form
# "C:/ABC/DEF", ".", etc.
#
# This script can be stored and edited as necessary, in a text file
# called SS_ListFiles.txt in a directory in your $path. The script can be called as
#
# script SS_ListFiles.txt dir("C:/myproject") files("*.cpp")
#
#
#####################################################################
# Declare FVA variables.
var str files
var str dir
# If directory is specified, make sure that it exists.
fdinfo $dir > null
if ($dir <> "")
do
fdinfo $dir > null
if ( ($fexists==false) OR ($ftype<>"d") )
exit 1 ("ERROR: SS_ListFiles: directory "+$dir+" does NOT exist.")
endif
done
endif
# Save previous directory in variable $pd.
var str pd
set $pd = { scd }
# Change directory to the desired directory.
cd $dir # If the user did not assign $dir, this command will not change directory.
# Output list of files.
lf -rn $files # If the user did not assign $files, this command will list all files and directories.
# Go back to previous directory
cd $pd
|
|
© 2008-2013, 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.
|
|