-
Notifications
You must be signed in to change notification settings - Fork 15
How to replace single DLLs on the server
Franziska Zander edited this page Mar 22, 2021
·
2 revisions
Sometimes it is not possible or necessary to build and copy everything new to add a small fix to your running instance. In order to ensure the DLL is replaced in all folders use the following script.
Before you run it you need to stop the IIS. Please also check for errors in the console during execution. This is mainly related to permission problems.
// install: npm install
// run: node index.js
const Fs = require( 'fs' ).promises,
Path = require( 'path' ),
Glob = require( 'glob-promise' );
const cfg = {
// source file
source: Path.join( __dirname, 'FILE_NAME' ),
// target base folder
target: 'PATH',
};
(async function(){
// file name of the source file
const filename = Path.parse( cfg.source ).base;
// print source file
console.log(filename);
// find all occurrences of the source file within target and its subfolders
const files = await Glob( `**/${filename}`, { cwd: cfg.target } );
// print found file list
console.log(files);
// replace all found files by source
for( const file of files ) {
const target = Path.join( cfg.target, file );
await Fs.copyFile( cfg.source, target );
// print replaced files
console.log( `replaced ${target}` );
}
// print error
})().catch( (e) => console.log(e) );{
"name": "filereplace",
"version": "1.0.0",
"description": "Replace a fille in all sub-directories",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sirko Schindler",
"contributors": ["Franziska Zander"],
"license": "ISC",
"dependencies": {
"glob": "^7.1.6",
"glob-promise": "^3.4.0"
}
}