Friday, September 20, 2013

Copying one file to multiple directories

Just a simple post to remind me how to do this in the future.

I needed to copy a new image to sixty (60) client directories, and symlinking like we would normally do was not an option. Thankfully xargs came to the rescue once again.  I found my answer here, but I wasn't going to type out the full paths for each of the sixty directories.

# echo /somedir/*/pub/product/images/ | xargs -n 1 cp -va preview_unavailable.png