A comprehensive cross-platform CLI tool for advanced directory analysis with file classification, duplicate detection, large file identification, interactive mode, HTML reports, and multiple export formats. Perfect for disk cleanup, storage audits, and pr
npm install dir-analysis-toolbash
npm install -g dir-analysis-tool
`
$3
`bash
npm install dir-analysis-tool
`
๐ Usage
$3
Analyze current directory:
`bash
dir-analysis-tool
`
Analyze specific directory:
`bash
dir-analysis-tool /path/to/directory
`
$3
`bash
dir-analysis-tool [directory] [options]
`
#### Core Options
- -p, --path - Target directory to analyze (default: current directory)
- -r, --recursive - Recursively analyze nested directories (default: true)
- --no-recursive - Disable recursive analysis
- -j, --json - Output results in JSON format
- -t, --types - Show file type classification summary (default: true)
- --no-types - Hide file type classification
#### Advanced Analysis
- -l, --large-files [threshold] - Detect large files (default: 100MB)
- -d, --duplicates - Enable duplicate file detection
- --empty-files - Detect and show empty files
- --top-n - Show top N largest files (default: 10)
- --tree - Display results in tree view format
#### Filtering Options
- -e, --exclude - Exclude file patterns or directories
- --max-depth - Maximum directory depth to scan
- --min-size - Filter files by minimum size (bytes)
- --max-size - Filter files by maximum size (bytes)
- --date-from - Filter files modified after this date (YYYY-MM-DD)
- --date-to - Filter files modified before this date (YYYY-MM-DD)
#### Export Options
- --csv [filename] - Export results to CSV file
- --csv-large [filename] - Export large files to CSV
- --csv-duplicates [filename] - Export duplicates to CSV
- --html [filename] - Generate HTML report with charts
#### Interactive & Monitoring
- -i, --interactive - Start interactive mode
- -w, --watch - Watch mode - monitor directory changes
- --progress - Show progress bar during analysis (default: true)
- --no-progress - Disable progress bar
#### Configuration
- -c, --config [path] - Load configuration from file
$3
#### Basic Analysis
`bash
Analyze current directory with file type classification
dir-analysis-tool
Analyze specific directory
dir-analysis-tool ~/Documents
Get JSON output
dir-analysis-tool --json ~/Downloads
`
#### Advanced Analysis
`bash
Find large files over 50MB and duplicates
dir-analysis-tool --large-files 52428800 --duplicates ~/Pictures
Show tree view with top 20 largest files
dir-analysis-tool --tree --top-n 20 /var/log
Analyze with filters
dir-analysis-tool --min-size 1048576 --max-depth 3 --exclude ".tmp" "cache"
`
#### Export and Reports
`bash
Generate HTML report
dir-analysis-tool --html report.html ~/Projects
Export to CSV files
dir-analysis-tool --csv analysis.csv --csv-large large-files.csv --duplicates
Export duplicates analysis
dir-analysis-tool --duplicates --csv-duplicates duplicates.csv
`
#### Interactive Mode
`bash
Start interactive explorer
dir-analysis-tool --interactive
Watch directory for changes
dir-analysis-tool --watch ~/Downloads
`
๐ Interactive Mode
Launch interactive mode for a guided analysis experience:
`bash
dir-analysis-tool -i
`
Interactive mode features:
- ๐ Guided Analysis - Step-by-step directory analysis
- ๐ Directory Navigation - Easy directory switching
- ๐ Multiple Views - Switch between different result views
- ๐พ Export Options - Export results in various formats
- โ๏ธ Advanced Settings - Configure analysis options
- ๐ Directory Comparison - Compare multiple directories
โ๏ธ Configuration
Create a configuration file to customize default behavior:
$3
`json
{
"excludePatterns": ["node_modules", ".git", "*.tmp"],
"largeSizeThreshold": 104857600,
"enableDuplicateDetection": false,
"enableProgressBar": true,
"outputFormat": "table",
"maxDepth": -1,
"topN": 10,
"showEmptyFiles": false
}
`
The tool automatically searches for configuration files in the current directory and parent directories.
๐ Output Formats
$3
Rich, colorized console output with:
- ๐ Directory summary
- ๐ File type breakdown
- ๐จ Large files list
- ๐ Duplicate file groups
- ๐ณ Tree view (optional)
$3
`json
{
"path": "/Users/example/Documents",
"totalSizeBytes": 1048576000,
"totalSizeMB": 1000,
"folders": 150,
"files": 2500,
"types": {
"images": 450,
"documents": 800,
"code": 300,
"other": 950
},
"largeFiles": [...],
"duplicateGroups": [...]
}
`
$3
Generate beautiful HTML reports with:
- ๐ Interactive charts
- ๐ Size distribution graphs
- ๐๏ธ File type breakdowns
- ๐ Detailed file listings
- ๐จ Modern, responsive design
$3
Export data to CSV for further analysis in spreadsheet applications.
๐ง API Usage
Use programmatically in your Node.js applications:
`javascript
import { DirectoryAnalyzer } from 'dir-analysis-tool';
const analyzer = new DirectoryAnalyzer();
const result = await analyzer.analyze({
path: '/path/to/analyze',
recursive: true,
excludePatterns: ['node_modules'],
largeSizeThreshold: 100 1024 1024, // 100MB
enableDuplicateDetection: true,
topN: 10
});
console.log(result);
``