Skip to main content
fixed typo
Source Link
b01
  • 4.4k
  • 3
  • 33
  • 32

I wish there was a way to do this without additional modules for something so minuscule and common, but this is the best I could come up with.

Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.

const execSync = require("child_process").execSync, fs = require("fs"), os = require("os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // WARNING: Do not specify a sinlesingle file as the windows rmdir command will error. if (fs.existsSync(theDir)) { console.log(' removing the ' + theDir + ' directory.'); execSync(removeDirCmd + '"' + theDir + '"', function (err) { console.log(err); }); } 

I wish there was a way to do this without additional modules for something so minuscule and common, but this is the best I could come up with.

Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.

const execSync = require("child_process").execSync, fs = require("fs"), os = require("os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // WARNING: Do not specify a sinle file as the windows rmdir command will error. if (fs.existsSync(theDir)) { console.log(' removing the ' + theDir + ' directory.'); execSync(removeDirCmd + '"' + theDir + '"', function (err) { console.log(err); }); } 

I wish there was a way to do this without additional modules for something so minuscule and common, but this is the best I could come up with.

Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.

const execSync = require("child_process").execSync, fs = require("fs"), os = require("os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // WARNING: Do not specify a single file as the windows rmdir command will error. if (fs.existsSync(theDir)) { console.log(' removing the ' + theDir + ' directory.'); execSync(removeDirCmd + '"' + theDir + '"', function (err) { console.log(err); }); } 
Added an update to have this work in a Windows OS environment.
Source Link
b01
  • 4.4k
  • 3
  • 33
  • 32

I wish I did not need anthere was a way to do this without additional modulemodules for something so minuscule and common, but this is the best I could come up with.

Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.

varconst  execSync = require("child_process").execSync(), cssDirfs = "web-ui/css"require("fs"), fsos = require("fs""os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // DeleteWARNING: Do not specify a sinle file as the csswindows directoryrmdir command will error. if (isCssDirfs.existsSync(theDir)) { console.log('removing' removing the ' + cssDirtheDir + ' directory.'); execSync("rmremoveDirCmd -rf+ "'"' + cssDirtheDir + '"', function (err) { console.log(err); }); } 

I wish I did not need an additional module for something so minuscule and common, but this is the best I could come up with.

var execSync = require("child_process").execSync(), cssDir = "web-ui/css", fs = require("fs"); // Delete the css directory if (isCssDir) { console.log('removing the ' + cssDir + ' directory.'); execSync("rm -rf " + cssDir, function (err) { console.log(err); }); } 

I wish there was a way to do this without additional modules for something so minuscule and common, but this is the best I could come up with.

Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.

const  execSync = require("child_process").execSync, fs = require("fs"), os = require("os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // WARNING: Do not specify a sinle file as the windows rmdir command will error. if (fs.existsSync(theDir)) { console.log(' removing the ' + theDir + ' directory.'); execSync(removeDirCmd + '"' + theDir + '"', function (err) { console.log(err); }); } 
Source Link
b01
  • 4.4k
  • 3
  • 33
  • 32

I wish I did not need an additional module for something so minuscule and common, but this is the best I could come up with.

var execSync = require("child_process").execSync(), cssDir = "web-ui/css", fs = require("fs"); // Delete the css directory if (isCssDir) { console.log('removing the ' + cssDir + ' directory.'); execSync("rm -rf " + cssDir, function (err) { console.log(err); }); }