Assume that you want to copy a file into multiple directories in the current directory, then all you have to do is, just entering following command in the terminal. Here, file.txt will be copied into all directories in the current directory. In case of a directory coping, replace
file.txt with
-rf [your dir].
for dir in *; do [ -d "$dir" ] && cp file.txt "$dir" ; done
for dir in *; do [ -d "$dir" ] && cp -rf /home/wageesha/images "$dir" ; done
Thank you this helped me alot! Cheers
ReplyDeleteis this also overwrite the existing files in directories
ReplyDeleteThanks. I tried it and it worked.
ReplyDeleteDo you invest in gold? Is this investment good?
ReplyDelete