How to combine files in subdirectories in macOS I have a folder with a lot of subfolders named as dates.
1-1-2013, 1-1-2014, 1-1-2015, ...

I want to combine all the files in subfolders that match the same year into a new folder named after the year. So in this example, all the folders ending in the year 2013 (1-1-2013) would go into a folder named &quot;2013&quot; and so on.
How do I accomplish this with Automator?
An easy way to do it would be use the Terminal, and write command as follows:
mkdir 2013

This create a folder named 2013 after the year.
mv *-2013/* 2013

This moves all the files from the folders those names end with &quot;-2013&quot; into the folder named 2013.
If you have a large number of years to do this for, consider using a simple bash script with a for loop - something like this:
for year in {2000..2020} 
do
  mkdir $year
  mv *-$year/* $year 
done