Skip to content

Instantly share code, notes, and snippets.

View kzndotsh's full-sized avatar

kzndotsh kzndotsh

View GitHub Profile
@kzndotsh
kzndotsh / alpha-organize.sh
Created September 19, 2023 14:57
alpha-organize.sh
#!/bin/bash
# alpha-organize.sh
#####################
# The following script is to help organize a directory of directories into alphabetical groups based on their initial characters
# This is useful for organizing a large directory of movies into alphabetical groups for easier importing into Radarr
#####################
# Set the source directory - this is the directory that contains the movies to be organized, this directory should contain only directories
@kzndotsh
kzndotsh / moveFilteredFilesToFolders.ps1
Created May 24, 2022 18:47
moveFilteredFilesToFolders.ps1
$items = gci .\ -Recurse -File -Include *480p*, *720p*, *1080p*
foreach($item in $items) {
if($item.Name -like "*480p*") {
Move-Item -LiteralPath $item 'G:\path\480p'
} elseif($item.Name -like "*720p*") {
Move-Item -LiteralPath $item 'G:\path\720p'
} elseif ($item.Name -like "*1080p*") {
Move-Item -LiteralPath $item 'G:\path\1080p'
@kzndotsh
kzndotsh / deleteEmptyFoldersRecursively.ps1
Created May 23, 2022 20:49
deleteEmptyFoldersRecursively.ps1
# Set to true to test the script
$whatIf = $false
# Remove hidden files, like thumbs.db
$removeHiddenFiles = $true
# Get hidden files or not. Depending on removeHiddenFiles setting
$getHiddelFiles = !$removeHiddenFiles
# Remove empty directories locally
@kzndotsh
kzndotsh / sortTorrentsByTracker.ps1
Last active September 18, 2022 17:42
sortTorrentsByTracker.ps1
<#
sortTorrentsByTracker.ps1
Sort .TORRENT files into subdirectories named after the tracker indicated in the file
Place this powershell script inside your /torrents directory, run the script and wait.
When finished, you will find all torrents organized into sub directories per tracker.
#>
$allfiles = gci "*.torrent"
$ToNatural= { [regex]::Replace($_, '\d+',{$args[0].Value.Padleft(20)})} # Define natural sort method