AppleScript / Automator to sort files based on filename I want to select a folder of QuickTime movies and copy each one into separate sub folders depending on the filename (by copying not moving).

I have a folder that I want to contain sub folders called XA and XB, but I only want them to copy across the h264 versions.

Example file names are as follows:

XA0000_v001_h264.mov
XA0000_v001.mov
XB0010_v002_h264.mov
XB0010_v002.mov


What would be an efficient way of coding this?
Apologies in advance if you only wanted a script. I would have commented, but I'm 5 rep short. This isn't an applescript/automator, but it still might help.

You can use Find any file. Website description: 


  Find Any File is a program for Apple's Mac OS X that lets you search
  for files on your disks.
  
  
  Contrary to Spotlight, it does not use a database but instead uses    the file system driver's fast search operations, where available. This lets you search for file properties such as name, dates, size, etc., but not for file content (that's what Spotlight is best at!) — unless you want to find plain text only). 
  Find Any File can find files that Spotlight doesn't, e.g. those inside bundles and packages and in inside folders that are usually
  excluded from Spotlight search. 
  Finally, it is quite fast. A search only takes a few seconds    on an internal hard disk or SSD. Try for yourself!
  


Basically, it's like "Everything" for mac. But what you could do is search for any file that ends with "_h264.mov" within the folder (whatever folder you feel like. If you want to automate, I suppose you could do a GUI script of find any file, but you might find another solution. 

Example image: