Andy Jarrett // Code. Develop. Create.

Copy/moving files from mulitple sub-directories to the parent

Since moving to Mac I use the terminal more and more. Today I had an issue of having wanting to move 1000 files in 50+ sub folders to the parent. A quick Google search didn't come up with anything so I figured it couldn't be too hard. My directories went like this/parent/parent/subfolder1/file.1/parent/subfolder1/file.2/parent/subfolder1/file.3/parent/subfolder2/file.1/parent/subfolder2/file.2and so on .... in reality each subfolder had 20 files in it.So to copy the files out was easy:[sourcecode language="plain"]cp -r ./* ../[/sourcecode]Swap the cp for mv to move them

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️