From: Florian Eder Subject: [PATCH 41/41] robocopy: add help message (/?) Message-Id: <20210906145518.346132-41-others.meder@gmail.com> Date: Mon, 6 Sep 2021 14:55:18 +0000 In-Reply-To: <20210906145518.346132-1-others.meder@gmail.com> References: <20210906145518.346132-1-others.meder@gmail.com> Signed-off-by: Florian Eder --- programs/robocopy/main.c | 12 ++++++++++++ programs/robocopy/robocopy.h | 4 +++- programs/robocopy/robocopy.rc | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/programs/robocopy/main.c b/programs/robocopy/main.c index 5c3c51d052a..154957ba08c 100644 --- a/programs/robocopy/main.c +++ b/programs/robocopy/main.c @@ -310,6 +310,11 @@ static void parse_arguments(int argc, WCHAR *argv[]) { options.create_no_new_files = TRUE; } + /* ? - Show help */ + else if (!wcsicmp(argv[i], L"/?")) + { + options.show_help = TRUE; + } /* lev - Limit depth of subdirectories */ else if (!wcsnicmp(argv[i], L"/lev:", 5)) { @@ -831,6 +836,13 @@ int __cdecl wmain(int argc, WCHAR *argv[]) FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); else logfile_handle = INVALID_HANDLE_VALUE; + if (options.show_help) + { + output_message(STRING_HEADER); + output_message(STRING_HELP); + return ROBOCOPY_ERROR_NO_FILES_COPIED; + } + /* If no file filters are set, set *.* to include all files */ if (options.files->size == 0) { diff --git a/programs/robocopy/robocopy.h b/programs/robocopy/robocopy.h index c0bdd836e31..dc3390a7f25 100644 --- a/programs/robocopy/robocopy.h +++ b/programs/robocopy/robocopy.h @@ -57,6 +57,7 @@ struct robocopy_options { BOOL create_no_new_files; WCHAR *logfile; BOOL log_append; + BOOL show_help; }; struct robocopy_statistics { @@ -93,4 +94,5 @@ struct robocopy_statistics { #define STRING_DELETE_DIRECTORY 1020 #define STRING_CREATE_FILE 1022 #define STRING_DELETE_FILE 1023 -#define STRING_MOVE_FILE 1024 \ No newline at end of file +#define STRING_MOVE_FILE 1024 +#define STRING_HELP 1027 \ No newline at end of file diff --git a/programs/robocopy/robocopy.rc b/programs/robocopy/robocopy.rc index df66753ca6b..b89418b578b 100644 --- a/programs/robocopy/robocopy.rc +++ b/programs/robocopy/robocopy.rc @@ -47,6 +47,30 @@ STRINGTABLE STRING_CREATE_FILE, " Copied File: %1\n" STRING_DELETE_FILE, " Deleted File: %1\n" STRING_MOVE_FILE, " Moved File: %1\n" + STRING_HELP, "Usage: robocopy source destination [files] [options]\n\ + \Available Options:\n\ + \ /s Copy non-empty sub-directories\n\ + \ /e Copy all sub-directories\n\ + \ /purge Remove files and directories already present in the destination\n\ + \ /mov Remove files from source after copying them\n\ + \ /move Remove files and directories from source after copying them\n\ + \ /l Dry run, does no actual file system operation\n\ + \ /lev: Copy only files and directories until n sub-directories deep into the source\n\ + \ /mir Alias of \"/e /purge\", mirrors source to destination\n\ + \ /xf path Exclude files (can contain wildcards)\n\ + \ /xd dir Exclude directories (can contain wildcards)\n\ + \ /min: Only include files that are at least n bytes big\n\ + \ /max: Only include files that are at most n bytes big\n\ + \ /minage: Only include files that are at least n days old\n\ + \ /maxage: Only include files that are at most n days old\n\ + \ /xo Don't overwrite files that are newer than the source file\n\ + \ /xn Don't overwrite files that are older than the source file\n\ + \ /xl Don't add new files to destination\n\ + \ /xx Don't remove files from the source when moving\n\ + \ /xc Don't overwrite files that have the same timestamp, but different size than the\n\ + \ source file\n\ + \ /log:path Write output to log file\n\ + \ /log+:path Append output to log file\n" } LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -- 2.32.0