Best way of copying a single file to multiple directories?

This is a discussion on Best way of copying a single file to multiple directories? within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi This might sound trivial but read on... I'm trying to install a (PHP-MySQL based) content management system ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2004
Peter Szmulik
 
Posts: n/a
Default Best way of copying a single file to multiple directories?

Hi

This might sound trivial but read on...

I'm trying to install a (PHP-MySQL based) content management system on
my ISP's Unix server. Turns out I need a custom php.ini file in each
directory that contaings php files. That might sound trivial but
belive me there are a few (!). It also took a while to upload all the
files in the first place...

What would the best way of copying my new php.ini file to all
directories in a directory tree be?


Best Regards
Peter
  #2 (permalink)  
Old 03-01-2004
chris-usenet@roaima.co.uk
 
Posts: n/a
Default Re: Best way of copying a single file to multiple directories?

Peter Szmulik <peter@szmulik.com> wrote:
> [...] I need a custom php.ini file in each
> directory that contaings php files. That might sound trivial but
> belive me there are a few (!). It also took a while to upload all the
> files in the first place...


> What would the best way of copying my new php.ini file to all
> directories in a directory tree be?


I'd suggest that maybe a good way forward would be to create a local
copy of the installation. You can then use a file transfer program that
understands recursive copying to transfer the entire directory tree in
"one" operation.

To install a file in each directory within a tree, I'd use a command
line utility. The unix-style "find" command could be used to do this
(there are versions of it for Windows platforms, too):

cd top-of-directory-tree
find * -type d -exec cp -p /path/to/source/php.ini {} \;

For a Windows platform you'd use "copy" in place of the "cp -p".
Chris
  #3 (permalink)  
Old 03-01-2004
chris-usenet@roaima.co.uk
 
Posts: n/a
Default Re: Best way of copying a single file to multiple directories?

Peter Szmulik <peter@szmulik.com> wrote:
> [...] I need a custom php.ini file in each
> directory that contaings php files. That might sound trivial but
> belive me there are a few (!). It also took a while to upload all the
> files in the first place...


> What would the best way of copying my new php.ini file to all
> directories in a directory tree be?


Assuming you have command line access to your server, you can use a
command like "find" to do this:

cd /top/of/tree
find * -type f -exec cp -p /source/to/original/php.ini {} \;

If you don't have command line access, then I'd suggest that the way
forward is for you to create a local directory structure that matches
your bit of your ISP's server. Put all your files in the local tree and
then use a file transfer program that understands recursive copies to
transfer the entire lot in "one" operation.

There are Windows (and probably Mac) versions of "find" available,
so you can populate the local directory tree easily, regardless of OS.

Chris
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:51 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0