Can someone please help me build a script?
I'm in the need of building a script to clean up my media library. I've been PVR'ing for years now and it's time to clean things up. For example, my TV Shows are saved as such:
/media/storage/Show Name/Season 1/Show Name - S01E01 - Episode Name.mp4 Over the years I've created a bunch of subdirectories further than that and I want to go through and clean those out. For example, the following directory might exist: /media/storage/Show Name/Season 1/subtitles If I use the find command, with -type d and -maxdepth 4, I have discovered that the subdirectory I want to delete is in the 4th level. There should be nothing valid in the 4th level and okay to delete. I don't really know where to start. I tried using the find command with -mindepth 4 but that doesn't seem to work as I would expect. Basically, I want to scan through the library, then I want to test to make sure that the directory isn't "Season XX" and if it is a subdirectory within Season X then I would like to delete that subdirectory. Any ideas how I can accomplish this? FYI: I'm using Korrora 21 with BASH. |
Try this:
Code:
find "/media/storage/Show Name" -mindepth 2 -type d Code:
find "/media/storage/Show Name" -mindepth 2 -type d -exec rm -fr "{}" \; |
Quote:
those "blank spaces" in the folder names are causing problems as above use quotes " File Name " on the FULL path to the folders |
Quote:
|
All times are GMT -5. The time now is 12:18 PM. |