Skip to content

Commit

Permalink
hardcoded executable name in usage message
Browse files Browse the repository at this point in the history
  • Loading branch information
McNetic committed Jul 15, 2015
1 parent 88b4d9f commit 08714fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Licensed under the GNU GPL. See COPYING for more information.
Short introduction
------------------

All existing utilities I could find either could not handle long pathnames (for example del /s /f /q) or are very slow. If you need to delete a few hundreds of thousands (or even millions) of files within reasonable time, this utility is the way to go.
All existing utilities I could find either could not handle long pathnames (for example del /s /f /q) or were very slow (windows explorer would take hours or days). If you need to delete a few hundreds of thousands (or even millions) of files within reasonable time, this utility is the way to go.

USAGE:

Expand All @@ -21,3 +21,4 @@ options:
/v - verbose (print statistics every few seconds)
/f - force deleting of read-only files

BE CAREFUL! fdeltree will recursively delete the given directory without any further messages or progress report. On my a bit dated machine, it deletes more than 75000 files/directories per minute from hard disk.
19 changes: 11 additions & 8 deletions fdeltree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "stdafx.h"
#include "time.h"

#define VERSION "0.1"
#define VERDATE "2015-07-08"
#define VERSION "0.2"
#define VERDATE "2015-07-15"
#define VERYEARS "2015"

//#define DEBUG
Expand Down Expand Up @@ -51,8 +51,11 @@

DWORD DeleteDirectory(const TCHAR* sPath, DWORD options = OPT_NONE);

int _cdecl usage(_TCHAR* basename, FILE* outstream = stderr) {
return _ftprintf(outstream, TEXT("Usage: %s [options] <directory>\noptions:\n /h - print this help\n /v - verbose (print statistics every few seconds)\n /f - force deleting of read-only files\n"), basename);
int _cdecl usage(FILE* outstream = stderr) {
return _ftprintf(outstream, TEXT("Usage: fdeltree [options] <directory>\noptions:\n")
TEXT(" /h - print this help\n /v - verbose (print statistics every few seconds)\n")
TEXT(" /f - force deleting of read-only files\n")
);
}

int _tmain(int argc, _TCHAR* argv[]) {
Expand All @@ -65,20 +68,20 @@ int _tmain(int argc, _TCHAR* argv[]) {

_tprintf(_T("fdeltree v%s (%s)\n(C) %s Nicolai Ehemann ([email protected])\n"), _T(VERSION), _T(VERDATE), _T(VERYEARS));
if (2 > argc) {
usage(argv[0]);
usage();
return ERROR_ARGUMENT_MISSING;
} else {
while (dirArg < argc) {
if (0 == _tcscmp(argv[dirArg], _T("/h")) || 0 == _tcscmp(argv[dirArg], _T("/H"))) {
_tprintf(_T("A simple, fast recursive file deletion utility\n"));
usage(argv[0], stdout);
usage(stdout);
return SUCCESS;
} else if (0 == _tcscmp(argv[dirArg], _T("/v")) || 0 == _tcscmp(argv[dirArg], _T("/V"))) {
options |= OPT_VERBOSE;
} else if (0 == _tcscmp(argv[dirArg], _T("/f")) || 0 == _tcscmp(argv[dirArg], _T("/F"))) {
options |= OPT_FORCE;
} else if (dirArg + 1 != argc) {
usage(argv[0], stderr);
usage(stderr);
return ERROR_INVALID_ARGUMENT;
} else {
fileArgFound = true;
Expand All @@ -88,7 +91,7 @@ int _tmain(int argc, _TCHAR* argv[]) {
}

if (!fileArgFound) {
usage(argv[0]);
usage();
return ERROR_ARGUMENT_MISSING;
} else if (0 == GetFullPathName(argv[argc - 1], MAX_LONG_PATH, sTmp, NULL))
{
Expand Down
Binary file added releases/fdeltree-0.2/fdeltree.exe
Binary file not shown.

0 comments on commit 08714fe

Please sign in to comment.