sfk general options reference:
Please note: some of these options are supported only by some commands.
general processing options-var insert SFK variables by using #(varname). type this
option directly after "sfk" to use it globally with all
commands in a chain or script. to print "#(" literally
then, escape it like ##(. for more on variables
type: sfk help var
-yes fully execute the command. some commands like "run" are
running in simulation mode by default, to avoid damage to your
files, as long as you're unsure which files and dirs to select.
as soon as you add -yes, however, everything is fully executed.
-keepchain never stop the command chain, even if commands that expect
filenames get none. for details: sfk help chain
-upat unix compatible file or text selection and patterns.
allows to use -subdir :/tmp instead of !\tmp, filter -:foo
instead of -!foo and run "#file" instead of "$file",
to create unified .sh batch files for Windows and Linux.
-upat2 same as -upat but also support wildcard % instead of *
you may also set this by an environment variable like:
-noesckey disable stop by escape key. (windows only)
file input options-nosub or -norec does not include subdirectories (subfolders).
processing of subdirs is DEFAULT with most commands,
therefore you must specify -nosub to switch it off.
-withsub include subdirs. is DEFAULT with most commands.
-withdirs include (sub) folder names in processing.
-justdirs use just (sub) folder names for processing.
-nofollow or -nofo does not follow symbolic directory links.
this option may NOT work with older Linux versions,
esp. those needing the "lib5" binary version of sfk.
-textfiles process only text files, no binaries. -text is the same,
but this may interfere with command-local -text options.
text/binary detection only checks the file's first 4 kbytes.
-binfiles process only binary files. -bin is the same, but this may
interfere with some command's local -bin option.
-hidden include hidden and system files.
-nohidden exclude hidden and system files.
-minsize=s select only files >= size, like 10b or 100k
-maxsize=s select only files <= size, like 10m or 4g
b=bytes k=kbytes m=megabytes g=gigabytes=10^9 bytes
K=2^10 bytes M=2^20 bytes G=2^30 bytes
-sincedir or -sincedif/add/chg: compare directory tree against
a reference tree, process only changed or added files.
see "sfk list" for details.
-since process only files changed on or after the supplied
date/timestamp. "sfk list" for details.
-before process only files changed before that date/timestamp.
-flist fn or "-fl fn" reads list of filenames from file fn.
-tomake .ext select only files that have no, or an older,
counterpart file with extension .ext in the same folder.
-tomake outdir\$base.ext select only files that have no or
an older counterpart file in outdir with extension .ext.
see "sfk run" for example: .wav to .mp3 conversion
-wchar activate EXPERIMENTAL utf-16 (ucs-2, wide char) decoding,
allowing sfk find or filter to search text in utf-16 files.
should not be used when (re)writing files. get more infos
by typing "sfk help unicode".
text input and filtering options-case activate case sensitive text comparison with some commands.
most text processing commands are case-insensitive by default.
filename comparison is always case insensitive.
for details see: sfk help nocase
-spat activates interpretation of slash patterns:
\t=TAB \q=" \r=CR \n=LF \\=\ \xnn=any char w/hex code nn
with some commands like replace, filter -form and -replace.
-spats strict slash patterns, show error on wrong patterns like \a.
-literal or -lit disables interpretation of wildcards * and ?
and slash patterns, if they were activated previously.
-nospat disables only slash patterns.
-deacc use accent insensitive text search and filename selection,
i.e. a == a_accent or o == o_umlaut.
-binallchars with binary-to-text conversion, include all printable
characters, like accents or non latin.
network options-header x or -head adds custom header x to http requests, like
-header "Accept-Language: de,en-US;q=0.7,en;q=0.3"
multiple header lines can be given. default headers
with the same name are replaced.
user information options-verbose print additional infos while running a command.
helpful if a command doesn't work as expected.
only some commands support -verbose. try also -verbose=2.
-more pause output based on terminal height.
-more50 paged output with 50 lines per page.
-more is experimental and may fail to count exactly.
-quiet reduce output on some commands. e.g. the find command will
not display the "scan" status info while searching files.
-quiet=2 reduce output even more on some commands.
-nowarn and -noerr, -nonote disable warn, error and note messages.
-nohead no not list header/trailer info on some commands: the run cmd
will not tell "simulating" even if it's in simulation mode.
-tracechain tell in detail how the command chain is executed.
-tracesel give verbose infos why directories and files have been
selected or excluded. -tracedirs lists only directories,
-tracefiles lists only files.
-debug print extra program flow infos to track errors.
-exectime tell command execution time at program end.
-headers print http headers with commands accessing the web.
file output options-tofile x specify a single output filename, which is taken as is
and not checked for any $ patterns.
-to mask specify where to write output files with some commands.
mask supports $file, $path, $relpath, $base, $ext and more,
like -to outdir\$base-modified.$ext
say "sfk run" for a list of possible keywords.
-tmpdir x set directory x as temporary file directory. default is
to use the path specified by TEMP or TMP env variable.
-showtmp tell verbosely which temporary files are created.
-keeptmp do not delete the temporary files, if possible.
terminal output options-nocol disable all colored output. important if your shell has
a background color incompatible to the default color scheme,
or (under linux) if the sfk output text must be processed
further through pipelining, and needs to be stripped from
the color escape sequences.
-col switch on colored output. "sfk help colors" for more.
-nocconv when printing output to the windows console, sfk tries
to convert umlaut and accent characters to display them
correctly with codepage 850. set -nocconv to disable this.
whenever output is redirected to file, no conversion is done.
-cconv force codepage conversions: if command output is redirected
to a file, codepage conversion is disabled by default.
use this option to activate, e.g. when post-processing
sfk run output which produced filename lists.
-html dump sfk help text (color control) in html format.
-html must be typed directly after "sfk".
-htmlpage the same, but include a header to view it in a browser.
return code and error options-showrc print sfk return code at end of command or program.
may not print anything in case of fatal errors,
like wrong syntax (usually rc 9).
-justrc let some commands print nothing and just produce an rc.
-exterr in case of operating system related errors like file access,
prints extended error information, if available.
-waitonerr wait for user input on every error.
-waitonend wait for user input at program end.
-stoponerr stop directory tree processing on first unreadable file.
default is to process as many files as possible, skipping
unreadable files and directories.
-rcfromerr some commands like filter, find, hexfind tell by shell rc
that something was found. by default, skipped errors like
unreadable files do NOT change this rc. with -rcfromerr,
skipped errors do override the resulting shell rc.
-echoonerr echo whole command to stderr when an error occurs.
see also the SFK_CONFIG setting "echoonstart" below.
to experiment with the above options, try "sfk errortest".
diverse options-arc read contents of well known zip, tar.gz and tar.bz2 archives
as deep as possible, including nested archives.
well known archives must have one of these extensions:
.zip .jar .ear .war .aar .xpi .tar .tar.gz .tar.bz2 .tgz
.gz .bz2 .docx .xlsx .dotx .pptx .odt .ods .otg .odp .odg
.dotm .docb .xlsm .xltx .xltm .pptm .potx .potm .ppam .ppsx
.ppsm .sldx .sldm .odc .odf .odi .odm .ott .ots .otp .jmod
to include further extensions, read below about SFK_ZIP_EXT.
this binary (SFK Base/XD) can read only the first 1000 bytes
of every archive entry. listing of contents is not limited.
type "sfk help xe" for all details and restrictions.
-xarc read contents of any zip file, regardless of file extension,
and tar.gz and tar.bz2 files. reads the first bytes of every
file and will therefore perform slower then -arc.
-qarc quick read top level archives but not nested ones.
-weblimit=n change web access download limit to n mbytes, with
functions like sfk web, filter, xex. default is 100 mb.
you may also set SFK_CONFIG=weblimit:30
-webtimeout=n web access timeout in msec. default is 10000.
you may also set SFK_CONFIG=webtimeout:3000
-webuser=u together with -webpw=p set HTTP basic authentication
with diverse commands supporting http:// web access.
-memlimit=n set the caching memory limit to n mbytes (default=300).
used if a function needs to load whole files into memory.
if zip etc. archive processing is very slow, it may be caused by
a cache overflow. try to increase the -memlimit then.
if you think sfk uses too much memory while processing files,
try to reduce -memlimit (values below 200 are not recommended).
you may also set SFK_CONFIG (see end of this text).
-cachestat tell amount of memory used by archive file cache.
-nocache disable the disk cache (for network files).
-noipex disable automatic IP expansion with some commands.
-noop do nothing (no operation). sometimes helpful as a fill-in.
command local versus global scope:
within a command chain, many options have an effect only locally
with the command where they are specified, e.g. in
sfk filt x.txt -case -high red FooCase +filt -high blue TheBar
the "-case" is valid only for the first filter command.
but the following options can also be used globally, if specified
directly after "sfk":
-nohead -noinfo -nofile -case -literal -spat
for example, in
sfk -case filt x.txt -high red FooCase +filt -high blue TheBar
the "-case" is valid for ALL commands in the command chain.
environment configuration:set SFK_CONFIG=columns:n,active-file-age:n,memlimit:n,...
sfk (for windows) tries to autodetect the no. of console columns,
but you may also set this value through this config parm.
some functions need to tell if a file is 'recently edited' or rather
old and inactive. by default, files > 30 days of age are considered
non-active. reconfigure the no. of days threshold here.
set memory limit to n mbytes.
echo the whole sfk command on start, to stderr.
echo the whole sfk command on errors, to stderr.
set folder for temporary files, used by some commands.
e.g. set SFK_CONFIG=tmpdir:d:\tmp,memlimit:500
set SFK_ZIP_EXT=".foo .bar .myext"
set additional, user defined zip file extensions. in this example,
files ending with .foo, .bar or .myext are also treated as zip files.
for the list of default extensions, look above at the -arc option.