[PLUG] Copying From Multiple Source Directories to a Destination Directory

Michael michael at jamhome.us
Mon Jun 14 15:21:42 UTC 2010




Rich Shepard wrote:
>    I'm upgrading PSTricks. There are 50
modules, and the relevant .tex files
> are each in its own directory.
I thought that I could cd to the parent
> directory of these and use
'cp -R *.tex
> /usr/share/texmf/tex/generic/pstricks' but the shell
tells me it cannot find
> a *.tex file.

The shell does that
because there are no *.tex files in the current directory.

The
expansion of *.tex occurs before cp sees the command line and in this case
what cp sees for arguments is "-R".


>    Do I
need to use a for loop so the shell knows to look in each directory
>
for the .tex file to copy? Or have I not used the cp command correctly?

You used cp correctly.  One approach to this would be:

     cp */*.tex

Which will work unless the
directory structure is deeper than one level.

Another approach
would be:

    cp `find . -name \*.tex`
<DESTDIR>

note:  the back ticks are the important
punctuation.  Look up above the tab key.



-- 

    Michael Rasmussen
   http://www.jamhome.us/
 Be Appropriate
&& Follow Your Curiosity



More information about the PLUG mailing list