Windows command -robocopy
The problem background
Because when the front-end project executes the publicDir setting, the NPM run build is executed to generate the infinitely nested dist folder, at this time, the file cannot be deleted to the garbage can by using delete/ or various file shredder, as shown in the figure:
The solution
- Infinitely nested folders
dist
Create a new directory at the same levelEmptyFile
folder
- On the CMD command line interface (CLI)
Robocopy /MIR EmptyFile dist
Copy the code
The command to explain
-
RoboCopy is a command line directory copy command.
#! Command: Robocopy /MIR source destinationCopy the code
-
/MIR indicates the mirror directory tree. It means to replicate subdirectories, including empty subdirectories and delete target files/directories that no longer exist in the source.