copy a file to a destination with different names
11,330
for i in {b,c,d}; do cp /path/to/directory/a.txt /path/to/file/$i.txt; done
Related videos on Youtube
Author by
tyler durden
Updated on September 18, 2022Comments
-
tyler durden almost 2 years
I want to copy a text file to a directory with multiple names with curly braces:
cp /path/to/file/a.txt /path/to/file/{b,c,d}.txt
But it gives me the error:
target '/path/to/directory/d.txt' is not a directory
-
tyler durden almost 8 yearsi'm really new to this. it didn't work, no error occurred, but there is no files inside the directory. should it be inside a script?
-
tyler durden almost 8 yearssorry, my bad, it worked, thanks for the answer!!