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 alias [-list|-del|-ren] [shortname] [=] [command] create, list, delete or rename command aliases. aliases are short command names selected by yourself to save typing effort. sfk alias shortname = command ... create an alias. this actually creates a small batch file in the directory where sfk itself is located. requirements: - the sfk executable has been copied into some directory x. - this directory x must be in your PATH. - you must have write permission for directory x. - directory x is NOT the current working directory ".". if any of these requirements is not met, the command will fail. for example, if sfk.exe is located just in your current working directory ".", copy sfk.exe into a different directory of the PATH, and then start aliasing. see also sfk mkcd : create an alias remembering the current directory. web reference http://stahlworks.com/sfk-alias examples sfk alias list = "sfk list" creates the alias named "list". from now on, you can type "list" instead of "sfk list". sfk alias wherc = "sfk list -arc . .jar filter -+%1.class" creates alias "wherc", searching for class files in jars. after the alias exists, command "wherc Foo" executes the commands from above, listing all class names with "Foo". sfk alias tab2c "sfk fromclip +filt -spat -rep _\t_,_ +toclip" then type tab2c to replace tabs by commas within clipboard. sfk alias copytoday "sfk run \"copy $file c:\tmp\" . -today" copy all files changed today to c:\tmp. if double quotes " should be part of your command, they must be escaped as \" sfk alias wide MODE CON COLS=160 extend the current shell window to a width of 160 columns. sfk alias ec "notepad c:\app\bin\%1.bat" provided that c:\app\bin is in your path, creates a command "ec" to instantly edit further commands. PARAMETER LIMITATION: note that the created batch files may accept only a maximum of 9 parameters, called %1 to %9. Further parameters may be ignored, or cannot be addressed. USE SURROUNDING QUOTES whenever your command string contains special characters like % \ ! otherwise these chars may be removed (or misinterpreted) by the command shell. sfk alias -list list all existing aliases. this actually scans the directory where sfk is located for batch files containing aliases. sfk alias shortname list definition of an existing alias. sfk alias -del aliasname delete an alias (deletes the associated batchfile). sfk alias -ren oldname newname rename an alias (renames the associated batchfile). more examples: sfk alias late = sfk list -late after that, you have a command "late", which can be used like: late . lists the most recent files in the current directory, including all subdirectories. sfk alias later = sfk list -norec -late creates a command "later", which can be used like: later . lists the most recent files in the current directory, NOT including subdirectories. sfk alias findhtm "sfk find -pat %2 %3 %4 -dir %1 -file .htm .php" creates a command "findhtm", which can be used like findhtm htdocs index.php mode searches all .htm, .html and .php files in directory htdocs, including all subdirectories, for text lines containing the words "index.php" AND "mode". sfk alias zipsince "sfk run -since %1 \"zip -r %2 $qfile\"" creates a command "zipsince", zipping files changed on or after a specific date, using zip.exe (free tool from the InfoZIP group). zipsince 20070303 update.zip work !.exe !.obj collect all files from directory "work", excluding .exe and .obj files, which have been changed since 03-Mar-2007, into a file "update.zip". sfk mkcd cdname creates an alias batch file, remembering the current directory. this batch can be used later to re-enter the remembered directory. example: 1. you are currently working in C:\Documents And Long Complicated Paths\Users\You\Work 2. now type: sfk mkcd cd1 which saves above path in a command "cd1". 3. you go into a different directory, e.g. C:\Another Project\Nested Dirs\Work2 4. now type: sfk mkcd cd2 => now, anytime you type: cd1 you jump instantly into C:\Documents And Long Complicated Paths\Users\You\Work and anytime you type: cd2 you jump instantly into C:\Another Project\Nested Dirs\Work2 if the creation of the alias fails, please type "sfk alias" to read about the required directories and access rights.
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.