folder-structure-sync
v1.1.0
Published
๐ Interactive CLI tool for syncing folder structures with smart selection, dependency handling, and beautiful output
Maintainers
Readme
๐ Folder Structure Sync
๐ Interactive CLI tool for syncing folder structures with smart selection, dependency handling, and beautiful output
Perfect for project templates, development environments, team onboarding, and automated deployments. Sync only what you need with intelligent dependency resolution and comprehensive exclusion patterns.
๐ Table of Contents
- โจ Features
- ๐ Quick Start
- ๐ฆ Installation
- ๐ Usage
- โ๏ธ Configuration
- ๐ฏ Smart Features
- ๐ธ Screenshots & Examples
- ๐ ๏ธ Development
- ๐ค Contributing
- ๐ Roadmap
- โ FAQ
- ๐ง Troubleshooting
- ๐ License
- ๐ Acknowledgments
โจ Features
- ๐ฏ Interactive Selection: Choose folders with checkbox interface or comma-separated numbers
- ๐ง Smart Dependencies: Auto-includes parent folders when children are selected
- ๐ซ Smart Exclusions: Configurable patterns with sensible defaults (
.git,node_modules, etc.) - ๐ Ignore File Support: Place
.ignorefile in any folder to skip it and all children during sync - ๐จ Beautiful Output: Colorful, hierarchical display with progress bars
- ๐ Dry Run Mode: Preview changes safely before execution
- โก Auto Mode: Perfect for scripts and CI/CD pipelines
- ๐ Detailed Reporting: Comprehensive operation summaries
- ๐ง Cross-Platform: Works on Windows, macOS, and Linux
๐ Quick Start
# Install globally from npm
npm install -g folder-structure-sync
# Or install locally in your project
npm install folder-structure-sync
# Run interactively
folder-sync ./source-folder ./target-folder
# Preview changes (recommended first run)
folder-sync ./source-folder ./target-folder --dry-run
# Auto-sync everything
folder-sync ./source-folder ./target-folder --auto๐ฆ Installation
# Global installation (recommended)
npm install -g folder-structure-sync
# Local installation
npm install folder-structure-sync
# Or run directly with npx (no installation needed)
npx folder-structure-sync ./source ./target --dry-run๐ Usage
๐ฎ Interactive Mode
The default mode provides a user-friendly selection interface:
folder-sync ./source-project ./target-projectExample interaction:
๐ Found 5 missing folders in target:
[1] โ src/
[2] โ src/components/
[3] โ src/utils/
[4] โ docs/
[5] โ tests/
๐ฏ Select folders to create:
Use arrow keys to navigate, space to toggle, enter to confirm๐ง Command Options
-d, --dry-run: Preview changes without executing-v, --verbose: Show detailed output-a, --auto: Auto-create all missing folders without prompting-h, --help: Show help information
๐ก Common Use Cases
# ๐ Preview changes (recommended first!)
folder-sync ./my-template ./new-project --dry-run
# ๐๏ธ Project template setup
folder-sync ./project-template ./new-project --auto
# ๐ฅ Team environment replication
folder-sync ./team-structure ./my-local-copy
# ๐ฆ Selective sync with verbose output
folder-sync ./large-project ./partial-copy --verbose
# ๐ค Automation/CI-CD pipeline
folder-sync "$SOURCE" "$TARGET" --autoโ๏ธ Configuration
The tool uses a sync-config.json file for exclusion patterns:
{
"defaultExclusions": [
".git",
".svn",
".hg", // Version control
"node_modules",
".npm",
".yarn", // Package managers
".DS_Store",
"Thumbs.db", // OS files
".vscode",
".idea", // IDE files
"*.tmp",
"*.log",
"*.cache", // Temporary files
"dist",
"build",
".next" // Build outputs
],
"customExclusions": [
"my-custom-folder", // Add your patterns here
"*.backup"
]
}๐ก Pro tip: Customize customExclusions for project-specific needs!
๐ฏ Smart Features
๐ฎ Interactive Selection
Two ways to select folders:
- Checkbox Interface: Navigate with
โโ, toggle withSpace, confirm withEnter - Number Input: Type comma-separated numbers like
1,3,5or ranges1-5
๐ง Dependency Resolution
When you select src/components/buttons/, the tool automatically:
- โ
Includes parent folders:
src/โsrc/components/โsrc/components/buttons/ - ๐ Shows you the complete dependency tree
- โก Creates folders in the correct order
๐จ Beautiful Output
๐ Validating paths...
๐ Scanning directories...
๐ Found 5 missing folders:
[1] src/ # Root level - cyan
[2] src/components/ # Level 1 - yellow
[3] src/components/ui/ # Level 2 - green
[4] docs/ # Root level - cyan
[5] tests/ # Root level - cyan
๐ Creating folders...
Progress |โโโโโโโโโโโโโโโโโโโโ| 100% | 5/5 folders
๐ Success: 5 created, 0 errors๐ธ Screenshots & Examples
โ Success Output
๐ Successfully processed 5 folders!
๐ Summary: 5 created, 0 errors๐ Dry Run Output
๐ Dry run - folders that would be created:
1. /target/src
2. /target/src/components
3. /target/docs
4. /target/tests
๐ This was a dry run - no actual changes were made.โ ๏ธ Error Handling
โ Error creating /restricted/folder: EACCES: permission denied
๐ Summary: 4 created, 1 error๐ ๏ธ Development
# Clone and setup
git clone https://github.com/unique01082/folder-structure-sync.git
cd folder-structure-sync
npm install
# Run tests (when available)
npm test
# Test with sample data
node index.js ./test-source ./test-target --dry-run๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Roadmap
- [x] ๐ฆ NPM package publication
- [ ] ๐งช Comprehensive test suite
- [ ] ๐ File sync capabilities (not just folders)
- [ ] ๐ Configuration presets for popular frameworks
- [ ] ๐ Advanced filtering with regex patterns
- [ ] ๐ฑ Interactive web interface
- [ ] โก Performance optimizations for large directories
โ FAQ
Q: Does this tool copy files?
A: No, it only creates folder structures. Files are not copied or modified.
Q: Is it safe to use in production?
A: Yes, especially with --dry-run first. The tool only creates folders and includes comprehensive error handling.
Q: Can I exclude specific patterns?
A: Absolutely! Use sync-config.json to customize exclusion patterns.
Q: Does it work with network drives?
A: Yes, as long as you have appropriate permissions.
๐ง Troubleshooting
Permission Errors: Run with elevated privileges or check folder permissions
Large Directories: Use --verbose to monitor progress
Configuration Issues: Check sync-config.json syntax with a JSON validator
๐ License
This project is licensed under the ISC License - see the LICENSE file for details.
๐ Acknowledgments
- Built with โค๏ธ using Commander.js, Chalk, Inquirer.js, and CLI Progress
- Inspired by the need for better development environment synchronization
โญ Star this repo if it helped you! | ๐ Report bugs | ๐ก Request features
