Swiss File Knife
a command line
free external tools,
- download the free Swiss File Knife Base from Sourceforge. - open the Windows CMD command line, Mac OS X Terminal or Linux shell. - OS X : type mv sfk-mac-i686.exe sfk and chmod +x sfk then ./sfk - Linux: type mv sfk-linux.exe sfk and chmod +x sfk then ./sfk OS X and Linux syntax may differ, check the help within the tool.
sfk list [-time] [-size|-size=digits] [...] dir [mask] sfk sel[ect] -dir dir1 dir2 -file .ext1 .ext2 !.ext3 [...] list all or just selected files from a directory tree. select is the same, but it ignores command chaining input. options -nosub do not list sub folder contents -time show date and modification time -flattime show date and time in a more compact format -tab separate columns by tab characters, not blanks -size[=n] show size of files [n characters wide] -kbytes or -kb lists sizes in kbytes instead of bytes -mbytes or -gbytes lists sizes in mbytes or gbytes -kbpure list without "kb" postfix -stat show statistics (number of files, dirs, bytes) and tell if hidden files or dirs were skipped. -nofollow or -nofo does not follow symbolic directory links. use this if list runs in an endless recursion. -withdirs list also directories -justdirs list just directories -hidden list also hidden or system files -arc list contents of well known zip, tar.gz and tar.bz2 archives as deep as possible, including nested archives. type "sfk help opt" for the list of well known file extensions. -qarc quick list archives, lists only archive entries at the top level, skipping nested archives. -xarc list 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. -qxarc quick list any archive content. -sort[=n] sort by name, list all or last n files -sortrev sort by name, in reverse order -late[=n] sort by time, list latest [n] files last -old[=n] sort by time, list oldest [n] files last -big[=n] sort by size, list biggest [n] files last -small[=n] sort by size, list smallest [n] files last -skiplate=n sort by time, select all except newest n -minsize=s list only files >= size, like 10b or 100k -maxsize=s list only files <= size, like 10m or 4g b=bytes k=kbytes m=megabytes g=gigabytes -late=all sort by time, list all files -notime don't list time, after -late or -old -nosize don't list size, after -big or -small -pure pure list of filenames, leave out time, size, headline or statistics. -quot surround filenames by double quotes. needed when post-processing filename lists containing blanks. -quiet do not show the "scan" progress information -since list only files since this timestamp, e.g. "2006-01-31 12:15:59" or 20060131121559, 2006-01-31 or 20060131. today: files changed since midnight of today. 1d: changed since 1 day, i.e. not counting from midnight, but 24 hours into the past. 5h, 30m, 10s : 5 hours, 30 minutes, 10 seconds. -before select files modified before that timestamp. -today short replacement for "-since today". -usectime use or list creation time instead of modification time. may not be available on some filesystems. -utc or -gmt lists UTC/GMT time instead of local time. -sincedir compare against another directory, list files that or -sd have been added, have different time, or content. does not list files which have been removed. -sinceadd like -sincedir, list only added files. -sincedif like -sincedir, list only changed files. does not list files with diff. time but same content. does not list added files. -sincechg list files with different content, and added files. or -sc does not list files with diff. time but same content. -relnames list filenames relative to specified directory(s), i.e. strip root directory names at the beginning. -abs[olute] list all filenames with full absolute path. -tofile x write all names directly to file x (using less memory than the chain command +tofile x). -maxfiles=n list a maximum of n files only. -fileoff[set]=n from all selected files, list only a subset, starting at index n. first file has index 0. -upat unix style exclusion syntax with : instead of ! e.g. -subdir :/tmp does the same as -subdir !\tmp -upat2 also support wildcard % instead of * -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 .ext. see "sfk run" for example: .wav to .mp3 conversion important details of file name / extension selection: - when specifying a filename pattern beginning with a dot "." and no wildcard, only files with this extension will be selected. - otherwise the pattern is searched anywhere within the filename. to force a filename start comparison, say \pattern (with a slash). - filename means the relative filename, not directory or path name. command chaining difference between list and select: +list accepts files from previous commands. +select ignores them, allowing scripts to run many independent selects in one chain. aliases sfk dir same as "sfk list -stat". sfk select same as list, but ignoring chain input. sfk larc same as "sfk list -arc". sfk late same as "sfk list -late". sfk today same as "sfk list -today". sfk big same as "sfk list -big". sfk old same as "sfk list -old". sfk small same as "sfk list -small". see also sfk help select the sfk file selection syntax. sfk help opt for further general options. sfk stat to list directory tree sizes. sfk filetime list all times of a file. web reference http://stahlworks.com/sfk-list more in the SFK Book the SFK Book contains a 60 page tutorial, including sfk dir and list examples with input, command and output. type "sfk book" for details. examples sfk list . list all files of current directory and all subdirectories. sfk list mydir !.bak !.tmp.txt list all files within mydir, except .bak and .tmp.txt files. sfk list -dir . -file foo .htm .java* this will find and list the following sample filenames: thefoobar.dat matches anywhere-pattern "foo" biginfo.htm matches exact extension ".htm" test.java.9.15 matches anywhere-pattern ".java*" the command will NOT list the following sample filenames: foosys\thebar.dat pattern must match filename, not path. biginfo.html does not match extension ".htm" sfk list -dir mydir !tmp !\save\ -file .txt list all .txt files within mydir, excluding all sub folders having "tmp" in their name, or called exactly "save". sfk alias list = sfk list -noop after this, just typing "list" lists the current directory. sfk list -dir src1 -file .cpp -dir src2 -file .hpp list .cpp files from src1, .hpp files from src2. sfk list -dir src "*examples*" list contents of all directories having a name with "examples", located somewhere below src. note that "*examples*" defines a path mask, whereas "examples" would be another root directory. under linux, patterns with a * wildcard MUST have quotes "". sfk list -late -dir . -sub foo -file .jsp .java list the most recent .jsp and .java files, in all dirs below the current one (.) having "foo" in their pathname. sfk list -late -dir . *foo -file .jsp .java the same, only shorter to type. sfk list -justdirs -dir . *foo* -file .jsp .java list all folders having "foo" in their pathname and which contain any .jsp or .java files. sfk list -sincedir src5 src1 .cpp provided that directory src5 is an older copy of src1, list the .cpp files that have been added/changed since src5 was created. sfk list -pure -late=30 -quot | zip ..\update.zip -@ collect the latest 30 files from current dir into a zip file, using InfoZIP's option "-@" to use a filename list from stdin. sfk sel src .bak +del select all .bak files in src, then delete them. sfk list -nosub -late mydir +sleep 5000 +loop list most recent files of mydir every 5 seconds, excluding all sub folder contents. sfk list . .jpg +count tell the number of .jpg files in current directory tree. sfk list soundlib .wav -tomake outdir\$base.mp3 list all .wav files in folder soundlib that have no or an older .mp3 file counterpart in folder outdir. see "sfk run" for the full -tomake example. sfk list -nosub -flattime -tabs . .jpg +filter -stabform "ren $qcol3 \q$col1$col2-$col3\q" +run "$text" rename all .jpg files in current folder to be prefixed by their modification time (type whole command in one line).  sfk larc src.zip +view show content listing of zip file src.zip in Depeche View, to search filenames interactively ("sfk view" for details). sfk list . >lslr list files of the current directory and all subdirectories into an index text file "lslr" (named after the unix command "ls -lR"). doing this in a root directory may take some while, but afterwards you will find the location of every file in realtime, by simply typing "sfk find lslr your_filename_pattern". sfk list -qarc -tofile lslrx . same as above, but including hidden and sys. files, as well as the first content level of every .zip and .jar file. using -tofile instead of ">lslrx" redirection allows you to see a progress info. doing this in a root dir like C:\ may produce a filename listing of several hundred MB in size. sfk list -hidden -arc -tofile lslrxl . produce an ultimate file listing, including hidden and sys. files, .zip and .jar contents, .tar, tar.gz and tar.bz2 contents, as well as archive contents embedded within archives, like .class files embedded within .jar files within a .tar.bz2 archive. running this command in a root dir like C:\ may take some hours, and it may produce a 1 GB or more file listing, so make sure there is enough disk space. examples with output: sfk list -late tfiles lists the most recent files within the directory tree "tfiles", including their date/time of last modification as the first column, sorted by modification time. example output: 2006-11-26 14:52:00 tfiles\BaseLib\Trace\include\Trace.hpp 2006-11-26 14:56:12 tfiles\FooBank\DB\include\DBController.hpp 2006-11-26 14:56:20 tfiles\FooBank\DB\source\DBController.cpp 2006-11-26 14:58:40 tfiles\Formats\18-ziptest.zip 2006-11-26 14:58:59 tfiles\Formats\19-jartest.jar 2006-11-26 15:10:20 tfiles\Formats\20-tab-data-line.txt sfk list -big testfiles list the biggest files of "testfiles", sorted by size. 39 testfiles\Formats\20-tab-data-line.txt 202 testfiles\BaseLib\Trace\include\Trace.hpp 237 testfiles\FooBank\DB\include\DBController.hpp 532 testfiles\FooBank\DB\source\DBController.cpp 8864 testfiles\Formats\18-ziptest.zip 8943 testfiles\Formats\19-jartest.jar sfk list -zip tdir list all files of "tdir", and the content of all .zip and .jar files found within: tdir\Formats\01-native-tab-crlf.txt tdir\Formats\02-crlf.txt tdir\Formats\15-float-text.txt tdir\Formats\16-short-words.txt tdir\Formats\18-ziptest.zip tdir\Formats\18-ziptest.zip\Formats/ tdir\Formats\18-ziptest.zip\Formats/02-crlf.txt tdir\Formats\18-ziptest.zip\Formats/14-all-codes.txt tdir\Formats\18-ziptest.zip\Formats/15-float-text.txt tdir\Formats\18-ziptest.zip\Formats/16-short-words.txt tdir\Formats\18-ziptest.zip\Formats/17 blank dir/ tdir\Formats\19-jartest.jar tdir\Formats\19-jartest.jar\META-INF/ tdir\Formats\19-jartest.jar\META-INF/MANIFEST.MF tdir\Formats\19-jartest.jar\Formats/ tdir\Formats\19-jartest.jar\Formats/02-crlf.txt tdir\Formats\19-jartest.jar\Formats/03-native-tab-lf.txt tdir\Formats\19-jartest.jar\Formats/04-lf.txt tdir\Formats\19-jartest.jar\Formats/14-all-codes.txt tdir\Formats\19-jartest.jar\Formats/15-float-text.txt tdir\Formats\19-jartest.jar\Formats/16-short-words.txt tdir\Formats\20-tab-data-line.txt
sfk is a free open-source tool, running instantly without installation efforts. no DLL's,
no registry changes - just get sfk.exe from the zip package and use it (binaries for
windows, linux and mac are included).
read more about all sfk functions here.