Swiss File Knife is a free but powerful command line tool that combines over 100 functions in one single portable executable that you can throw in a USB flash drive and carry around with you. With Swiss File Knife, you can search, convert, compare, or even synchronize folders or files, send UDP or HTTP requests, download HTTP files, find duplicate files, show tree size, etc.
Download and set up
You can download the Swiss File Knife executable file for Windows from here (direct download link) or from SourceForge, and save it in the same folder where you keep all your portable tools i.e. Sysinternals, or directly in the c:\windows\system32 folder for easy access without the navigation.
Getting the help for the syntax of the command
Swiss File Knife (sfk) is one single command line wth so many switches and parameters that are impossible to memorize them all. So it’s important to know where to get the help when needed.
Let’s start with the following first, if you don’t know where to begin.
It lists all the commands you can use with the SFK command.
As you can see, all commands are listed in different categories,
- File system
- Text processing
- Search and compare
Then, when you know which command to use, use the following for help on that command for details.
A few examples
Now let’s take a look at a few samples to see how powerful it is.
List folders larger than 1 GB within a specified folder
sfk treesize1000 -flat z:\data
sfk sync srcRoot dstRoot [-dir subdir1 subdir2] [-file .ext1 .ext2]
The Sync command does nearly the same as copy, except that the files that exist in the destination but not in the source, called STALE files, will be deleted if older than 30 days.
Convert spaces to TAB
sfk entab=3 . .txt .sql
The above command replaces three spaces each by a TAB character in all .txt and .sql files within the current folder.
Deal with MD5 hashes
To calculate the MD5 hash of a particular file:
sfk md5 file
To use MD5 hash to compare two files:
sfk md5 file1 file2
To create a list of MD5 checksum hashes over all files in the current folder:
sfk md5gento=md5.txt .
Run an instant HTTP server
It launches an HTTP server waiting on port 80 by default. Perfect for data transfer in a LAN environment or even over the internet if you can modify the firewall setting.
Type the address in the browser to access the folder shared through the HTTP server.
Swiss File Knife is truly a powerful command line packed with tons of features and functions. With all documented in great detail, it’s surprisingly easy to get hands on it. It’s a great addition to Windows Sysinternals Suite.
Swiss File Knife runs not only on Windows but Linux and Mac as well. It’s free for general use. But for serious users who frequently deal with large files, you may consider the Extended Edition (XE) which features a high performance replace command for large text and binary files, which can also read .zip, .jar, .tar.gz and .tar.bz2 file contents.