https://github.com/ran-dall/export-contents
https://github.com/ran-dall/export-contents
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ran-dall/export-contents
- Owner: ran-dall
- Created: 2025-02-22T01:57:09.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-02-22T01:57:11.000Z (11 months ago)
- Last Synced: 2025-03-09T19:36:24.243Z (10 months ago)
- Language: PowerShell
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Export-Contents
## Overview
Export-Contents is a PowerShell module designed to efficiently gather and concatenate file contents from a directory into a single output file. It provides flexible filtering options, path handling, and hidden file support, making it ideal for code analysis, documentation, and content aggregation tasks.
## Installation
```powershell
Install-Module -Name Export-Contents -Scope CurrentUser -Force
```
## Features
### Directory Content Export
```powershell
# Basic usage with defaults
Export-DirectoryContents -Path "C:\Projects\MyCode"
# Include hidden files with absolute paths
Export-DirectoryContents -Path "C:\Projects\MyCode" `
-OutputFile "FullExport.txt" `
-UseAbsolutePaths `
-IncludeHiddenFiles
```
Creates a consolidated export with:
- File headers marking content boundaries
- Relative or absolute path references
- Optional hidden file inclusion
- Customizable output location
- System file filtering
### Directory Structure
```
Export-Contents/
├── Source/
│ ├── Public/ # Exported functions
│ │ └── Export-DirectoryContents.ps1
│ ├── Private/ # Internal functions
│ │ └── Get-FilteredFile.ps1
├── Tests/ # Pester tests
├── Export-Contents.psm1 # Module loader
├── Export-Contents.psd1 # Module manifest
└── README.md
```
### Usage Examples
#### Basic Export
```powershell
# Export current directory contents
Export-DirectoryContents
# Export specific directory with custom output file
Export-DirectoryContents -Path "C:\Source\MyProject" -OutputFile "ProjectContents.txt"
```
#### Advanced Options
```powershell
# Include hidden files with absolute paths
Export-DirectoryContents -Path "C:\Logs" `
-OutputFile "FullLogs.txt" `
-UseAbsolutePaths `
-IncludeHiddenFiles
# Export with relative paths (default)
Export-DirectoryContents -Path ".\src" -OutputFile "SourceCode.txt"
```
### Output Format
The exported file contains entries in this format:
```
--- FILE: ./path/to/file.txt ---
[File contents here]
--- FILE: ./path/to/another.txt ---
[File contents here]
```
## Requirements
- PowerShell 5.1 or later
- Windows PowerShell or PowerShell Core
## Parameters
### Export-DirectoryContents
- **`-Path`** (String)
- Directory to process
- Default: Current directory (".")
- Accepts pipeline input
- **`-OutputFile`** (String)
- Output file path
- Default: "DirectoryContents.txt"
- Creates or overwrites existing file
- **`-UseAbsolutePaths`** (Switch)
- Use full file paths in output
- Default: False (uses relative paths)
- **`-IncludeHiddenFiles`** (Switch)
- Include hidden files in export
- Default: False (excludes hidden files)
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This module is licensed under the OSL-3.0 License.