Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Copy a file to all subfolders of a folder with one command' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Copy a file to all subfolders of a folder with one command
Authored by: zeniam1 on Mar 02, '10 07:57:43AM
Via Bash for just the immediate children directories:
for d in *; do [[ -d "$d" ]] && cp php.ini "$d"; done
I knew about the -exec flag in find, but I'm more comfortable just writing quick Bash scripts. Note that the given find command will descend into subdirectories, whereas the above one-liner will not.

[ Reply to This | # ]
Copy a file to all subfolders of a folder with one command
Authored by: fracai on Mar 02, '10 10:59:22AM
Rather than: for d in *; do [[ -d "$d" ]] && cp php.ini "$d"; done
You can do: for d in */; do cp php.ini "$d"; done
---
i am jack's amusing sig file


[ Reply to This | # ]
Copy a file to all subfolders of a folder with one command
Authored by: zeniam1 on Mar 03, '10 12:33:57PM

Most excellent! Thanks for the tip!



[ Reply to This | # ]