Hi all,
I know next to nothing about bash programming but I have had a crack at something for my media PC.
What I'm trying to do is, on start-up, automatically create a list of the latest episode of each TV show that has been added to the PC. Currently my script removes the old list, creates a new text file, manually determines the last added episode in each TV show directory and then adds it to the list. When I say manually, I mean I have added a line for each and every TV show:
Now this is fine....except I have 27 different TV shows, each with their own directory, and this is being added to on a regular basis. I would like something more robust - something that when given a starting directory can work its way into each sub-directory, recognize when it can't dig any deeper and then determine the latest file in that directory. Once it's done this is starts back at the top and moves onto the next directory. It would do this until it's gone through all the directories in the starting directory that was given to it.Code:ls -Art /location_of media/tv_show_one/* | tail -n 1 >> $latest_episodes.txt ls -Art /location_of media/tv_show_two/* | tail -n 1 >> $latest_episodes.txt ls -Art /location_of media/tv_show_three/* | tail -n 1 >> $latest_episodes.txt ...and so on.
Is this something that can be done? Is it worth it?
I've started reading and Googling but it's getting late where I am, I'm tired and I need to hit the sack. Just casting a net out to see if I can get a little bit of a head start on this tomorrow
Thanks,
- Matt
Bookmarks