Hello,
I have a small question and i hope someone can help me, if i have 200 domains directories in my server under this directory
something like
now how i can copy one folder i have to this directories?
Thank You
Hello,
I have a small question and i hope someone can help me, if i have 200 domains directories in my server under this directory
something like
now how i can copy one folder i have to this directories?
Thank You
Best bet is to tar up your directory to a file
tar cvf /path/to/mydir.tar ./mydir
Then extract the tar into each domain directory:
for dir in /var/www/domain*
do
cd $dir
printf "Extracting to $dir.."
tar xf /path/to/mydir.tar
echo
done
Thank you Chubler_XL for replay
I can do that in one job for all domains? not per each domain.
cd /var/www
find . -type d -a -name "domain*" | xargs -i cp /path/to/your/file/foo.txt {}
this will cp the foo.txt to all subdirs.
The script I posted will do it for all domains (perhaps I should have worded my post more carefully).
If you tar up your directory and type the script as it is above and hit enter you will see:
$ for dir in /var/www/domain*
>do
> cd $dir
> printf "Extracting to $dir.."
> tar xf /path/to/mydir.tar
> echo
>done
Extracting to /var/www/domain1.com...
Extracting to /var/www/domain2.com...
Extracting to /var/www/domain3.com...
Extracting to /var/www/domain4.com...
Extracting to /var/www/domain5.com...
Extracting to /var/www/domain6.com...
... and so on ...
[code]
This is very small and interesting one .