
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Dir-Cloner is a command-line tool for cloning directory structures into a JSON format, allowing you to selectively copy file contents, skip specific files or directories, and rebuild directory structures from the JSON file. This tool is particularly useful for replicating directory structures while avoiding large audio or video files or customizing the contents to be copied.
To install Dir-Cloner, ensure you have Node.js installed, and then use npm to install the tool globally:
npm install -g dir-cloner
This will make the dir-cloner command available globally on your system.
The clone command generates a JSON file that represents the structure of a directory. By default, audio and video files will not have their contents copied.
dir-cloner clone -s /path/to/source/directory -o /path/to/output.json
-s, --source: Path to the source directory to be cloned.-o, --output: Path to the output JSON file.You can manually edit the generated JSON file to customize the structure:
"skip": true to skip a file or directory during the rebuild."copyContent": true or "copyContent": false to control whether the content of a file should be copied.Once the JSON file is configured, use the copy-content command to copy the contents of files that are marked for content copying. This command saves the content in a separate JSON file to keep the main JSON easier to manage.
dir-cloner copy-content -i /my/config/folder-structure.json -s /my/source/folder -o /my/config/updated-folder-structure.json
-i, --input: Path to the JSON file.-s, --source: Path to the original source directory (used during cloning).-d, --destination: Path to the output JSON file where updated content will be saved.-v, --verbose: Enable verbose logging (optional).The rebuild command reconstructs the directory structure from the JSON file. This will create directories and files as specified in the JSON. The content will be copied from a separate JSON file if it was previously done using the copy-content command.
dir-cloner rebuild -i /path/to/folder-structure.json -c /path/to/file-contents.json -d /path/to/destination
-i, --input: Path to the JSON file with directory structure.-c, --content: Path to the JSON file with file contents.-d, --destination: Path to the destination directory where the structure will be rebuilt.-o, --overwrite: Overwrite existing files with content from JSON (optional, default: false).-v, --verbose: Enable verbose logging (optional).Follow these steps to clone, customize, and rebuild a directory structure:
dir-cloner clone -s /my/source/folder -o /my/config folder-structure.json
This command creates a JSON file representing the structure of /my/source/folder.
Edit the JSON: Open /my/config/folder-structure.json and modify it according to your requirements. For example, set "skip": true for files you want to exclude or "copyContent": true for files you want to include content.
Copy contents of specific files:
dir-cloner copy-content -i /my/config/folder-structure.json -s /my/source/folder -o /my/config/file-contents.json
This copies the contents of files marked with "copyContent": true from the source and saves the updated JSON to the specified output file.
dir-cloner rebuild -i /my/config/folder-structure.json -c /my/config/file-contents.json -d /my/target/folder -o -v
This reconstructs the directory structure in /my/target/ folder as defined in the JSON file, and copies the file contents from the separate JSON file.
Contributions are welcome! Please follow these steps:
If you encounter any issues or have questions, feel free to open an issue on GitHub.
This project is licensed under the MIT License.
FAQs
Help user to clone directory
We found that dir-cloner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.