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-64.exe sfk and chmod +x sfk then ./sfk - Linux: type mv sfk-linux-64.exe sfk and chmod +x sfk then ./sfk OS X and Linux syntax may differ, check the help within the tool.
sfk copy srcRoot dstRoot [-dir subdir1 subdir2] [-file .ext1 .ext2] sfk sync srcRoot dstRoot [-dir subdir1 subdir2] [-file .ext1 .ext2] Directory tree copy, update copy and synchronization. If destination does not yet exist, whole content of source is copied, INCLUDING HIDDEN AND SYSTEM FILES. If destination already exists, only updates are copied. Symbolic links are NOT kept, but their content is duplicated. If this is a problem, use a copy command of your operating system instead. copy copies files from source to destination if the target file doesn't exist yet, or if the source is NEWER than the target. copy will NOT copy OLDER files over NEWER files. furthermore, files that exist in destination but not in source are not removed, so copy will ADD and REPLACE, but not DELETE. sync nearly same as copy, however files that exist in destination but not in the source are called STALE files, and are DELETED if their age is >= 30 days. USE WITH CARE. If you specify wrong folders or file masks, this may delete files unintentionally. Take a close look at the output of the simulation mode, which is active by default. -mirror with sync, copy even older files from source over destination. -wipe delete stale files now (ignoring file ages). -nocopy with sync, do not copy files, run only delete cleanup. can be used if you want copy files first with a different copy program, and then run an sfk sync-delete. -diff list files in destination which have been modified after last copy. Whenever you get a short info "n differing files in dest", add -dif to get their names listed. -since or -sincedir/dif/add/chg copies only files selected by age or difference to another directory. "sfk list" for details. -nohidden exclude hidden and system files from copy. -nofollow do not follow symbolic link directory contents. -nodirtime since sfk 126.96.36.199 folder times are copied by default. to disable it use this, or set SFK_CONFIG=nodirtime -stat in simulation: do not list filenames, only size statistics. -keepstale=n change the 30 days limit for stale files until deletion. -noinfo do not comment on skipped files. -rel[names] only with input chaining: strips source root directory names from filenames. if not selected, absolute paths starting like C:\ or /tmp will be stripped automatically. some chain commands may provide filenames without separate directories, in this case -relnames will produce an error. -ltarg always list target filenames (instead of source filenames). -flat[=c] do not create sub folders in output, but copy all into the same single output dir, with long flat names joining path parts by '-' or a given character c. -flat2 like -flat but without path parts. there is no check for redundant output names. files with whole content being copied are listed in default color. files that will be deleted during sync are listed in warning color. files with differing time but equal content are listed in time color. completeness and efficiency: - under Windows, SFK uses the CopyFileEx API function, which should be able to copy most file attributes and contents as good and fast as the XCopy command provided with Windows. - under Linux, no native copy function is available, therefore SFK may not be able to copy all attributes, access rights and timestamps of the original files. Furthermore, copying can be slower than "cp". - Directory attributes, access rights and time stamps may not be completely reproduced both on Windows and Linux. - Changes from/to Daylight Saving Time, differing time zones or copies between FAT and NTFS may always copy files which were copied already. this is a general problem with all copy commands. using file system views: if you want to specify many directory trees and dir/file masks, you may create a fileset, containing a list of directories. type "sfk help fileset" for details. NO WARRANTY FOR DATA INTEGRITY. SFK copy is very convenient to use, but if you need to copy massive amounts of highly important data, it is recommended to use the original copy command of your operating system. Always keep backups of important stuff. After large copies, do some spot checking if important files were really copied without modifications. Always double-check the reliability of external media like USB sticks, e.g. by creating md5 lists (see "sfk md5gento"). see also sfk move move files between two folders. sfk syncnames sync file name changes. web reference http://stahlworks.com/sfk-copy examples sfk copy g:\myimage.zip . copy file myimage.zip from drive G: into the current folder. doing so with sfk will show the progress while copying. sfk copy c:\work d:\arc\work -dir . !\tmp\ !\save\ -file !.bak copy directory tree c:\work to d:\arc\work, excluding all dirs called tmp or save, including all files except .bak files. sfk copy d:\proj v:\team\proj -dir foosys\include foosys\source tools within directory tree proj, copy subdirectory trees foosys\include, foosys\source and tools, including all files therein. sfk filter testfiles -+foo +copy \tmp copy all files from testfiles containing "foo" to \tmp. sfk copy work archive -fileset myflist.txt copy the files listed in myflist.txt from work to archive. note that "-yes" must be specified directly after "copy". see also "sfk help fileset". sfk list mydir .txt .doc code.cpp +copy d:\save copies all .txt, .doc and code.cpp files from within mydir, including all subdirs, to d:\save. ALSO copies mycode.cpp, subcode.cpp.1 etc. as "code.cpp" ist just a pattern. sfk list -sincedir mydir1 -dir mydir2 -subdir !\save\ -file !.bak +copy mydir3 copies all files that were added or changed between mydir1 and mydir2 to mydir3, excluding files in sub folders "save", and excluding .bak files (type whole command in one line). type "sfk list" for more on -sincedir, -sinceadd or -sincedif. sfk sel website .jpg .png .gif +copy tmp -flat copy all images from all subfolders within website into a single flat output folder tmp, without any sub folders. this allows to get an image overview (gallery) by opening tmp within windows explorer. sfk sel a.txt b.txt c.txt +copy \tmp copy enumerated files to \tmp sfk fromclip +copy \tmp copy files listed in the clipboard to \tmp
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.