Given a folder structure, such as:
/Parent-Folder
/Child-Folder
/Child-Child-Folder
...
How do I copy/paste all child folders to a list of destinations, such as:
Dest Folder/
Dest Folder2/
Dest Folder3/
Given a folder structure, such as:
/Parent-Folder
/Child-Folder
/Child-Child-Folder
...
How do I copy/paste all child folders to a list of destinations, such as:
Dest Folder/
Dest Folder2/
Dest Folder3/
This solution is a combination of two posts. One related to recursively moving folders and another related to generating a list of folders.
destinations.txt
could look like:"Dest Folder/"
"Dest Folder2/"
"Dest Folder3/"
xargs -tI % cp -r "parent-folder/" % < destinations.txt
How it Works
xargs -tI % [command] % < [file]
This portion calls a command for each line in a file.
cp -r source/ dest/
This is the command being repeated. It recursively copies the contents of the source folder to a destination folder.