copy | deblank | delete | deltree | filefind | filetime | fixfile | index | list | mkdir | name | olist | partcopy | rename | setbytes | space | sync | touch | treesize | Команда: delete If you want to delete, for example, only .bak and .tmp filesin a directory tree, within sub folders names tmp or save, then sfk delete helps with its very flexible file selection syntax. Free open source command line tool for Windows, Mac OS X, Linux and Raspberry Pi.sfk delete dir ext1 [ext2 ...] [-yes] sfk deltree targetdir [-yes] sfk del -dir dir1 dir2 -file .ext1 delete files or dirs, even if they're write protected. deltree or rmtree deletes a directory tree with all contents. options -yes really delete the files. without option -yes, del only lists the files that would be deleted. -withdirs if you supply a file mask other than "*", or -wdir and file deletion leads to an empty directory, then the directory is removed as well. if you supply no file mask (or "*"), then every empty directory is always deleted. this option cannot be used with chaining, as chaining passes only filenames, but no processed directory names. -hidden include hidden and system files. this option is default when using deltree. -quiet print nothing -stat show statistics even with -quiet -stoponerr stop chain execution if delete is incomplete. -retry=n[:d] if delete fails, retry up to n times waiting d ms inbetween. default with deltree (not del) is -retry=2:100 command return codes rc 0 : ok all deleted rc 5 : delete incomplete rc 9 : sfk rc with -stoponerr lazy confirmation on command chaining if you selected files in a command chain, then want to add +del you may type "+del." (with a dot) or "+del!" (windows only) instead of "+del -yes" to actually delete the files. web reference http://stahlworks.com/sfk-del examples sfk del -withdirs src .bak deletes .bak files within src and all subdirs. if a directory contained only .bak files, it is deleted as well. sfk del -yes -withdirs -hidden tmp delete tmp with all files, including hidden files. sfk deltree. tmp the same as above, with "." as a short for -yes. sfk list -dir src -file foo*.hpp +del first list target files, then add +del sfk fromclip +del take a list of filenames from clipboard and delete them. see "sfk help shell" on how to configure your windows command prompt, to allow easy copying of filename lists. example with output: I plan to delete all .bak files in directory tree "src1", and all .tmp files in directory tree "src2": sfk del -dir src1 -file .bak -dir src2 -file .tmp [simulating:] DEL : src1\FooBank\BarDriver\include\BarGlass.bak DEL : src1\FooBank\BarDriver\include\BarMug.bak DEL : src1\FooBank\DB\include\DBController.bak DEL : src1\FooBank\GUI\include\FooGUI.bak DEL : src2\FooBank\BarDriver\include\BarGlass.tmp DEL : src2\FooBank\BarDriver\include\BarMug.tmp DEL : src2\FooBank\DB\include\DBController.tmp DEL : src2\FooBank\GUI\include\FooGUI.tmp 10 files would be deleted. [say -yes, -del. or -del! to execute.] But I see: oops, I want to keep DBController.bak as it may be needed later... same applies for FooGUI.tmp. No problem - above is just a simulation, so nothing happened yet. I adapt the command to: sfk del -dir src1 -file .bak !DBCon -dir src2 -file .tmp !FooGUI [simulating:] DEL : src1\FooBank\BarDriver\include\BarGlass.bak DEL : src1\FooBank\BarDriver\include\BarMug.bak DEL : src1\FooBank\GUI\include\FooGUI.bak DEL : src2\FooBank\BarDriver\include\BarGlass.tmp DEL : src2\FooBank\BarDriver\include\BarMug.tmp DEL : src2\FooBank\DB\include\DBController.tmp 8 files would be deleted. [say -yes, -del. or -del! to execute.] The result looks OK, so I add "-yes" to really delete the files. |
![]() |