{"id":23346349,"url":"https://github.com/tuckn/wshdirbackupper","last_synced_at":"2026-05-10T02:05:04.859Z","repository":{"id":40694924,"uuid":"284167051","full_name":"tuckn/WshDirBackUpper","owner":"tuckn","description":"The WSH (Windows Script Host) CLI that updates or mirrors directories according to the schema defined in a JSON file.","archived":false,"fork":false,"pushed_at":"2024-01-25T22:12:06.000Z","size":358,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T17:19:44.257Z","etag":null,"topics":["backup","cli","jscript","json","mirroring","schema","windows","wsf","wsh"],"latest_commit_sha":null,"homepage":"https://tuckn.net/docs/WshDirBackUpper/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuckn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tuckn"],"patreon":"tuckn","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-08-01T02:01:49.000Z","updated_at":"2024-06-27T09:33:29.000Z","dependencies_parsed_at":"2025-02-13T19:33:15.166Z","dependency_job_id":"976cc919-3341-4240-8a2b-93afab88d31c","html_url":"https://github.com/tuckn/WshDirBackUpper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tuckn/WshDirBackUpper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshDirBackUpper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshDirBackUpper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshDirBackUpper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshDirBackUpper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuckn","download_url":"https://codeload.github.com/tuckn/WshDirBackUpper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshDirBackUpper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259957270,"owners_count":22937544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","cli","jscript","json","mirroring","schema","windows","wsf","wsh"],"created_at":"2024-12-21T07:13:32.329Z","updated_at":"2026-05-10T02:05:04.809Z","avatar_url":"https://github.com/tuckn.png","language":"JavaScript","funding_links":["https://github.com/sponsors/tuckn","https://patreon.com/tuckn"],"categories":[],"sub_categories":[],"readme":"# WshDirBackUpper\n\nThe WSH (Windows Script Host) CLI updates or mirrors or archives directories according to the schema defined in a JSON file.\n\n## Operating environment\n\nWorks on JScript in Windows.\n\n## Installation\n\nDownload this ZIP and unzip or Use the following `git` command.\n\n```console\nD:\\\u003e git clone https://github.com/tuckn/WshDirBackUpper.git\nD:\\\u003e cd WshDirBackUpper\n```\n\nNow suppose your directory structure looks like this.\n\n```console\nD:\\WshDirBackUpper\\\n  ├─ .wsh\\\n  │ └─ settings.json\n  └─ dist\\\n     ├─ Run.wsf\n     └─ bundle.js\n```\n\n## Usage\n\n### Command Line\n\nCopy the directory\n\n```console\n\u003e cscript .\\dist\\Run.wsf backup \"C:\\Users\\Public\" \"\\\\MyNas\\Archives\"\n```\n\nArchive each sub directory in the directory \"C:\\Users\\Public\"\n\n```console\n\u003e cscript .\\dist\\Run.wsf archive \"C:\\Users\\Public\" \"\\\\MyNas\\Archives\"\n```\n\n### With Schema JSON\n\nThe JSON default path to load is _%CD%\\.wsh\\\\settings.json_.\nSee _.\\\\.wsh\\\\settings.json_ as example.\n\nWrite your backing up schema in the JSON file, for example,\n\n```json\n{\n  \"dirBackUpperSchema\": {\n    \"tasks\": {\n      \"userAppData\": {\n        \"srcDir\": \"C:\\\\Users\\\\Default\\\\AppData\",\n        \"destDir\": \"\\\\\\\\MyNas\\\\BackUp\\\\User\\\\AppData\",\n        \"method\": \"MIRROR\", // default: \"UPDATE\"\n      },\n      \"appLog\": {\n        \"srcDir\": \"D:\\\\logs\\\\csv\",\n        \"destDir\": \"\\\\\\\\MyNas\\\\BackUp\\\\csvLogs\",\n        \"method\": \"ARCHIVE\", // default: \"UPDATE\"\n      }\n    }\n  }\n}\n```\n\nYou can also define variables into `components` object.\nThe defined variable can be used as `${valName}` in `tasks`.\n\n```json\n{\n  \"dirBackUpperSchema\": {\n    \"components\": {\n      \"dest\": \"\\\\\\\\MyNas\\\\BackUp\"\n    },\n    \"tasks\": {\n      \"userAppData\": {\n        \"srcDir\": \"C:\\\\Users\\\\Default\\\\AppData\",\n        \"destDir\": \"${dest}\\\\User\\\\AppData\",\n        \"method\": \"MIRROR\",\n      },\n      \"appLog\": {\n        \"srcDir\": \"D:\\\\logs\\\\csv\",\n        \"destDir\": \"${dest}\\\\csvLogs\",\n        \"method\": \"ARCHIVE\",\n      }\n    }\n  }\n}\n```\n\nYou can also use a date code literal to define `srcDir` and `destDir`.\n\n```json\n{\n  \"dirBackUpperSchema\": {\n    \"tasks\": {\n      \"appLog:current\": {\n        \"srcDir\": \"C:\\\\logs\\\\csv\",\n        \"destDir\": \"D:\\\\BackUp\\\\#{yyyy}\\\\#{MM}\",\n        \"method\": \"MIRROR\",\n      },\n      \"appLog:lastMonth\": {\n        \"srcDir\": \"D:\\\\BackUp\\\\#{yyyy\\\\[MM-1]}\",\n        \"destDir\": \"\\\\MyNas\\\\CsvLogs\\\\#{yyyy\\\\[MM-1]}\",\n        \"method\": \"ARCHIVE\",\n      }\n    }\n  }\n}\n```\n\nSee [WshUtil: parseDateLiteral](https://tuckn.net/docs/WshUtil/Wsh.Util.html#.parseDateLiteral) for the literal.\n\nAnd can also use backing up options.\n\n```json\n  \"dirBackUpperSchema\": {\n    \"tasks\": {\n      \"userAppData\": {\n        \"srcDir\": \"C:\\\\Users\\\\Default\\\\AppData\",\n        \"destDir\": \"D:\\\\Backup\\\\AppData\\\\#{yyyy}\\\\#{MM-dd}\",\n        \"method\": \"MIRROR\", // default: \"UPDATE\"\n        \"options\": {\n          \"comparison\": \"CONTENT\", // default: \"TIME\"\n          \"isRecursive\": false,\n          \"copiesEmpDir\": true,\n          \"includesSymlink\": true,\n          \"matchedRegExp\": \"\\\\.csv$\",\n          \"ignoredRegExp\": [\n            \"Windows\\\\\\\\WebCache\",\n            \"Packages\\\\\\\\.*Cache\\\\\\\\\",\n            \"\\\\.mui$\",\n            \"\\\\.settingcontent-ms$\"\n          ]\n        }\n      },\n      \"appLog:current:rar\": {\n        \"srcDir\": \"D:\\\\AppLogs\\\\#{yyyy}\\\\#{MM}\",\n        \"destDir\": \"\\\\MyNas\\\\AppLogs\\\\#{yyyy}\\\\#{MM}\",\n        \"method\": \"ARCHIVE\",\n        \"options\": {\n            \"archiveType\": \"RAR\", // default: \"ZIP\"\n            \"archiveOptions\": {\n              \"dirWinRar\": \"C:\\\\My Apps\\\\WinRAR\",\n              \"dateCode\": \"yyyy-MM-dd\",\n              \"compressLv\": 0,\n              \"password\": \"This is mY\u0026p@ss ^_\u003c\"\n            },\n            \"ignoredRegExp\": [\"^\\\\.git.*$\"]\n        }\n      }\n    }\n  }\n```\n\nSee below to know all options.\n\n- When the `method` is `UPDATE` or `MIRROR`, You can use [WshDirBackUpper: typeSchemaBackUpperTask](https://tuckn.net/docs/WshDirBackUpper/global.html#typeSchemaBackUpperTask)\n- When the `method` is `ARCHIVE` and `options.archiveType` is `ZIP`, You can use [WshZLIB: typeDeflateZipOption](https://tuckn.net/docs/WshZLIB/global.html#typeDeflateZipOption)\n- When the `method` is `ARCHIVE` and `options.archiveType` is `RAR`, You can use [WshZLIB: typeDeflateRarOption](https://tuckn.net/docs/WshZLIB/global.html#typeDeflateRarOption)\n\nYou can use the `schemaBackup` command to perform processing from the schema JSON file.\n\nFor example, the below command runs all available backing up tasks defined in the JSON.\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaBackup *\n```\n\nCan specify any tasks to run with property names.\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaBackup appLog:*\n```\n\nShow the help.\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaBackup --help\n\nUsage: schemaBackup [overwriteKey:val...] [options]\n\nThe command to back up directories defined with a schema JSON\n\nOptions:\n  -V, --version          Output the version number\n  -D, --dir-path \u003cpath\u003e  The path name where the schema JSON is located. \u003cDirectory Path\u003e or \"cwd\", \"portable\", \"userProfile\". Default: \"cmd\" is \"%CD%\\.wsh\"\n  -F, --file-name \u003cname\u003e A JSON file name. (default: \"settings.json\")\n  -E, --encoding \u003cname\u003e  The JSON file encoding. (default: \"utf-8\")\n  -N, --prop-name \u003cname\u003e A property name of the schema object. (default: \"dirBackUpperSchema\")\n  -T, --task \u003cname\u003e      Specify the task name to back up. e.g. \"work:*\" (default: \"*\")\n  -L, --logger \u003cval\u003e     \u003clevel\u003e/\u003ctransportation\u003e. e.g. \"warn/popup\".  (default: \"info/console\")\n  -R, --dry-run          No execute. Outputs the string of command. (default: false)\n  -h, --help             Output usage information\n```\n\nSee [Wsh.ConfigStore](https://tuckn.net/docs/WshConfigStore/) for the options `--dir-path` and `--file-name`.\nand see [Wsh.Logger](https://tuckn.net/docs/WshLogger/) for the options `--logger`.\n\n## Installation as Module\n\n(1) Create a directory of your WSH project.\n\n```console\nD:\\\u003e mkdir MyWshProject\nD:\\\u003e cd MyWshProject\n```\n\n(2) Download this ZIP and unzip or Use the following `git` command.\n\n```console\n\u003e git clone https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\nor\n\u003e git submodule add https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\n```\n\n(3) Include _.\\\\WshDirBackUpper\\\\dist\\\\bundle.js_ into your .wsf file.\nFor Example, if your file structure is\n\n```console\nD:\\MyWshProject\\\n├─ Run.wsf\n├─ MyScript.js\n└─ WshModules\\\n    └─ WshDirBackUpper\\\n        └─ dist\\\n          └─ bundle.js\n```\n\nThe content of the above _Run.wsf_ is\n\n```xml\n\u003cpackage\u003e\n  \u003cjob id = \"run\"\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshDirBackUpper/dist/bundle.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.js\"\u003e\u003c/script\u003e\n  \u003c/job\u003e\n\u003c/package\u003e\n```\n\nI recommend this WSH file (.wsf) encoding to be UTF-8 [BOM, CRLF].\n\n### Together with another Apps\n\nIf you want to use it together with another Apps, install as following\n\n```console\n\u003e git clone https://github.com/tuckn/WshBasicPackage.git ./WshModules/WshBasicPackage\n\u003e git clone https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\n\u003e git clone https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\nor\n\u003e git submodule add https://github.com/tuckn/WshBasicPackage.git ./WshModules/WshBasicPackage\n\u003e git submodule add https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\n\u003e git submodule add https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\n```\n\n```xml\n\u003cpackage\u003e\n  \u003cjob id = \"run\"\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshBasicPackage/dist/bundle.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshSmbConnector/dist/module.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshDirBackUpper/dist/module.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.js\"\u003e\u003c/script\u003e\n  \u003c/job\u003e\n\u003c/package\u003e\n```\n\n## Usage as Module\n\nNow _.\\\\MyScript.js_ (JScript ) can use `Wsh.DirBackUpper`.\n\nBacking up and logging.\n\n```js\nvar bkup = Wsh.DirBackUpper; // Shorthand\n\nvar srcDir = 'C:\\\\Users';\nvar destDir = 'D:\\\\BackUp\\\\Users\\\\${yyyy-MM}';\n\nbkup.backupDir(srcDir, destDir, {\n  syncMethod: 'MIRROR',\n  comparison: 'CONTENT',\n  ignoredRegExp: 'tmp$',\n  logger: 'warn/winEvent' // See https://github.com/tuckn/WshLogger\n});\n```\n\nWith Schema\n\nExample of using a schema\n\n```js\nvar bkup = Wsh.DirBackUpper; // Shorthand\n\nvar schema = {\n  description: 'Example Schema WshDirBackUpper',\n  components: {\n    exe7z: 'C:\\\\My Apps\\\\7-Zip\\\\7z.exe',\n  },\n  tasks: {\n    userAppData: {\n      srcDir: 'C:\\\\Users\\\\Default\\\\AppData',\n      destDir: 'D:\\\\AppData\\\\#{yyyy}\\\\#{MM-dd}',\n      method: 'UPDATE',\n      options: {\n        comparison: 'TIME',\n        ignoredRegExp: ['Packages\\\\\\\\.*Cache\\\\\\\\', '\\\\.mui$']\n      }\n    },\n    'appLog:current': {\n      srcDir: 'D:\\\\My App Data',\n      destDir: '\\\\\\\\MyNas\\\\AppLogs\\\\#{yyyy}\\\\#{MM}',\n      method: 'ARCHIVE',\n      options: {\n        archiveType: 'ZIP',\n        exe7z: '${exe7z}',\n        dateCode: 'yyyyMMddThhMMss',\n        compressLv: 9,\n        ignoredRegExp: ['^\\\\.git.*']\n      }\n    },\n    'appLog:lastMonth': {\n      available: false,\n      srcDir: 'D:\\\\AppLogs\\\\#{yyyy\\\\[MM-1]}',\n      destDir: '\\\\\\\\MyNas\\\\AppLogs\\\\#{yyyy\\\\[MM-1]}'\n      method: 'MIRROR'\n    }\n  }\n};\n\nbkup.backupDirUsingSchema(schema, 'appLog:*', {\n  logger: 'info/console'\n});\n// Only process appLog:current. appLog:lastMonth is not processed because available is false.\n```\n\n### Dependency Modules\n\nYou can also use [tuckn/WshBasicPackage](https://github.com/tuckn/WshBasicPackage) functions in _.\\\\MyScript.js_ (JScript).\n\n## Documentation\n\nSee all specifications [here](https://tuckn.net/docs/WshDirBackUpper/) and also [WshBasicPackage](https://tuckn.net/docs/WshBasicPackage/).\n\n## License\n\nMIT\n\nCopyright (c) 2020 [Tuckn](https://github.com/tuckn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshdirbackupper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuckn%2Fwshdirbackupper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshdirbackupper/lists"}