Ditto command and wildcard on Catalina?
I've learnt a bit about ditto and tried this:
mkdir testingdir
ditto myfile.css testingdir
which seemed to work.
How could I ditto one file , e.g. myfile.css to several folders within testingdir, e.g. dir1, dir2, dir3 using zsh on Catalina?
Learning about ditto and tried Google'ing but am not sure.
You need to use a for
loop for this (works in both zsh
and bash
):
for target in "dir1" "dir2" "dir3"; do
ditto -- "myfile.css" "testingdir/$target"
done
If the target directories are actually called dir1
etc you can use wildcard expansion
for target in dir[1-3]; do
ditto -- "myfile.css" "testingdir/$target"
done