0

I have plenty of movie files saved in folders with roughly the following scheme.

Top-most folder: "The Matrix (1999)", then another folder "matrix movie" and then the actual movie itself: "matrix1999.avi"

I need a small program that can search my main movies folder "Movies" for the above situation and then sort ALL found movie folders as follows:

Top-most folder: "The Matrix (1999)" with the movie inside ""The Matrix (1999).avi" ...the previous middle folder "matrix movie" is now gone.

Incase the last-nested folder contains more that one avi's then its gonna be "The Matrix (1999)-part1.avi", "The Matrix (1999)-part2.avi", etc.

if there are more than one "middle" folders that should be discovered and again the *.avi files moved to the top-most folder, deleting the "middle" ones.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • This isn't too hard with a scripting language like Python, Ruby or even Perl, all of which come standard with OS X. It's possible as a shell script but usually a lot more messy. Do you have a preference here? Also some more sample data would be nice, plus an example of what you've tried. – tadman May 06 '16 at 17:23

1 Answers1

0

I had a similar problem the below one liner solved mine:

find . -printf '%P\0' | pax -0rws ':/:_:g' ./output_folder/

I was also looking for html files that are bigger than a threshold:

find . -name '*.html' -size +1024c -printf '%P\0' | pax -0rws ':/:_:g' ./output_folder/

Hope it helps.

cgl
  • 1,106
  • 1
  • 13
  • 27