https://github.com/abdullahmaqbool22/windows-file-organizer
This PowerShell script organizes files in a specified directory into subfolders based on their file extensions. For example, all .txt files will be moved to a folder named txt.
https://github.com/abdullahmaqbool22/windows-file-organizer
file organizer powershell windows
Last synced: 2 months ago
JSON representation
This PowerShell script organizes files in a specified directory into subfolders based on their file extensions. For example, all .txt files will be moved to a folder named txt.
- Host: GitHub
- URL: https://github.com/abdullahmaqbool22/windows-file-organizer
- Owner: AbdullahMaqbool22
- License: mit
- Created: 2024-07-30T12:54:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-30T22:00:43.000Z (almost 2 years ago)
- Last Synced: 2025-05-21T23:39:48.136Z (about 1 year ago)
- Topics: file, organizer, powershell, windows
- Language: PowerShell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Windows File Organizer
This PowerShell script organizes files in a specified directory into subfolders based on their file extensions. For example, all `.txt` files will be moved to a folder named `txt`.
## Features
- Automatically create folders based on file extensions.
- Move files into corresponding folders based on their extensions.
- Easy to use and modify.
## Requirements
- Windows PowerShell (available on all modern Windows systems).
- Appropriate permissions to create folders and move files in the specified directory.
## Usage
1. **Download or Clone the Script**: Download the `OrganizeFilesByExtension.ps1` script from this repository or copy the content from below.
2. **Modify the Script**:
- Open the script in a text editor.
- Set the `$sourceDirectory` variable to the path of the directory you want to organize. For example:
```powershell
$sourceDirectory = "C:\path\to\your\directory"
```
- Save the changes.
3. **Run the Script**:
- Open PowerShell as an administrator.
- Navigate to the directory where the script is located using the `cd` command.
- Execute the script by typing:
```powershell
.\OrganizeFilesByExtension.ps1
```
4. **Result**: The script will create folders named after each file extension in the specified directory and move the corresponding files into these folders.
## Notes
- **Backup Your Data**: Always ensure you have backups of your data before running scripts that modify files.
- **Customizations**: You can modify the script to include files from subdirectories by adding the `-Recurse` parameter to the `Get-ChildItem` command.
- **Permissions**: Make sure you have the necessary permissions to run the script and modify the files in the directory.
## License
This script is open-source and available for use and modification. Feel free to customize it according to your needs.