How does js generate folders according to the path?

for example, if the path is / csrSystemXYK/src/com/sunyard/csr/action/
, then create a folder?

Jun.02,2021

if it is nodejs , fs.existsSync determine whether there is a step-by-step fs.mkdirSync > create


you can take a look at

use nodejs, shell's implementation package, str.split ("/") to generate an array. Traversing mkdir


node contains api:
fs.mkdir (path [, mode], callback)
) that creates a directory. However, only if the current path exists, can it exist at the next level. You can transfer the path path to an array and call it through the loop

.
Menu