I need to add one file to about 7 different directories. I'm using Fedora 24... I know I need to use the touch command but what parameters will I need?
Asked
Active
Viewed 75 times
2 Answers
3
Use brace expansion in bash:
touch {dir1,dir2,dir3,dir4,dir5,dir6,dir7}/file
If the directories are named after a pattern, you might even be able to generate that. For example, if the directories were actually named like on the command above:
touch dir{1..7}/file

muru
- 197,895
- 55
- 485
- 740
2
If directories are different use this:
touch {d1,d2,d3,d4,d5,d6,d7}/file_name
Or you can use this one:
touch dir{1..7}/file_name
This command creates file in dir1, dir2, ... dir7 respectively.

muru
- 197,895
- 55
- 485
- 740
touch {dir1,dir2,...,dir7}/file
– muru Nov 28 '16 at 16:24Fedora
in your question. – WinEunuuchs2Unix Nov 28 '16 at 16:30