Copying a file to multiple locations
- Jan
- 17
- Posted by TKH Specialist
- Posted in bash, System Administration
I thought this was cool enough to share. I have not had to use it however so I doubt it is all that useful 😉
xargs -n 1 cp -v foo.txt<<<"/tmp1/ /tmp2/ /tmp3/"
Here we are copying one file named foo.txt to multiple directories called /tmp/1/, /tmp/2/, and /tmp/3 using xargs. The xargs command construct argument list(s) and execute utility such as cp.
If you find a use for this let me know. Backup copies seems useful but other than that…?
Recent Comments
- Stefan on Flush This!
- Timestamping your Bash History | Matt's Entropy on Remember when you issued that command…?
- Matt Smith on Remember when you issued that command…?
- Ruan on Putting ‘lsof’ to use
- Dylan F. Marquis on External Mapping of LDAP attributes in CAS