Last active
May 6, 2023 16:12
-
-
Save patent-ed/70af956fc1f064fdcfc4f628f8c93b6b to your computer and use it in GitHub Desktop.
a macOS script that removes .ts files older than 7 days from the "Plex Media" folder on the user Teddy's desktop and the /Users/Teddy/Movies folder, you can use a bash script.
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
#!/bin/bash | |
# Set directories | |
plex_media_folder="/Users/Teddy/Desktop/Plex Media" | |
movies_folder="/Users/Teddy/Movies" | |
# Find and remove .ts files older than 7 days | |
find "${plex_media_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \; | |
find "${movies_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \; | |
echo "Old Plex media files removed successfully." | |
# This empty's the trash can | |
osascript -e 'tell application "Finder" to empty the trash' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment