Skip to content
Snippets Groups Projects
Commit 7723edad authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add -file=name|pattern option to specify files to add/update

postfile.js still should be used for adding a single file to a filebase,
but when updating a single file, this seemed like a simple enhancement.
It also allows filtering of files to be added by wildcard (e.g. *.zip),
so potentially useful for adding files too.

Address enhancement request #348
parent ad7a7474
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -37,6 +37,7 @@ var listfile;
var date_fmt;
var options = {};
var exclude = [];
var include = "*";
var dir_list = [];
var verbosity = 0;
for(var i = 0; i < argc; i++) {
......@@ -51,6 +52,7 @@ for(var i = 0; i < argc; i++) {
writeln(" -all add files in all libraries/directories (implies -auto)");
writeln(" -lib=<name> add files in all directories of specified library (implies -auto)");
writeln(" -from=<name> specify uploader's user name (may require quotes)");
writeln(" -file=<name> specify files to add (wildcards supported, default: *)");
writeln(" -ex=<filename> add to excluded filename list");
writeln(" (default: " + default_excludes.join(',') + ")");
writeln(" -diz always extract/use description in archive");
......@@ -79,6 +81,10 @@ for(var i = 0; i < argc; i++) {
options.auto = true;
continue;
}
if(opt.indexOf("file=") == 0) {
include = opt.slice(5);
continue;
}
if(opt.indexOf("from=") == 0) {
uploader = opt.slice(5);
continue;
......@@ -187,6 +193,8 @@ for(var d = 0; d < dir_list.length; d++) {
file_list.push({ name: file_getname(list[i]) });
}
}
file_list = file_list.filter(function(obj) { return wildmatch(obj.name, include); });
for(var i = 0; i < file_list.length; i++) {
var file = file_list[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment