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

1 Answer 1

for i in {b,c,d}; do cp /path/to/directory/a.txt /path/to/file/$i.txt; done
  • i'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? Jul 13, 2016 at 7:19
  • sorry, my bad, it worked, thanks for the answer!! Jul 13, 2016 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .