Created
September 23, 2023 22:22
-
-
Save jibbius/eac317486e996e5a86350ff258f73ad1 to your computer and use it in GitHub Desktop.
Reorganise Humble Bundle Book downloads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1 | |
# ------ | |
# Open Powershell ISE | |
# - If you encounter permissions errors, Run as Administrator, then use the command: | |
# Set-ExecutionPolicy RemoteSigned | |
# Step 2 | |
# ------ | |
# Download everything using this FireFox plugin: | |
# - https://addons.mozilla.org/en-US/firefox/addon/humble-bundle-downloader/ | |
# Step 3 | |
# ------ | |
# Set the names of directories: | |
$my_dir_one = 'D:\Downloads\HumbleBundle\Databases And Data Management' | |
$my_dir_two = 'D:\Downloads\HumbleBundle_Sorted' | |
# Step 4 | |
# ------ | |
# Use the script below to reorganise the files: | |
$files = Get-ChildItem $my_dir_one -Recurse -Include * -Attributes !Directory | |
$files = $files | Sort-Object -Property BaseName | |
foreach ($f in $files){ | |
echo $f.BaseName | |
# Use filename to generate directory name | |
$target_dir = $my_dir_two + '\' + $f.BaseName | |
if (Test-Path $target_dir) { | |
# Folder already exists | |
} else { | |
New-Item $target_dir -ItemType Directory | |
} | |
# Determine target filename: | |
$source_filename = $f.FullName | |
$target_filename = $target_dir + '\' + $f.Name | |
# Copy to the new location: | |
Copy-Item -Path $source_filename -Destination $target_filename | |
# Alternatively, move to the new location: | |
#Move-Item -Path $source_filename -Destination $target_filename | |
} |
Author
jibbius
commented
Sep 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment