Alberto Monteiro wrote:
> 
> Is there any simple Linux command that
> does the equivalent to M$-DOS 
> "xcopy <dir1>\<file1> <dir2> /F/D/S" ?
> 
> I would like to copy a whole directory,
> including subdirectories, but _not_ copy
> when the destination file is not older than
> the source file.
> 
> Alberto Monteiro


I might suggest something like:

  find /sourcedir/ | cpio -pd /targetdir/


This lets you use all of the fun tools
available in find, as well as not copying
over target files when the target is newer
than the source.



I've included excerpts from the cpio man page
(in the version I'm using, it might be different
on yours) to help explain the options and
behaviors described. (NOTE: I am NOT using -u)


-- Matt





-----------------------------------------------


NAME
     cpio -- archiver to copy and back up files

SYNOPSIS
     cpio -o [-aBcHhvyz] [-C blocksize] [-O file]
             [-V volpat]
     cpio -i [-BbcdfHhmrsStuvqy]  [-C blocksize]
             [-I file] [-V volpat] [pattern...]
     cpio -p [-aBdlmruv] directory

     -p   copies the list  of files read
          from standard input to the specified        
  directory. You can use this option
          to copy entire file trees.

     -d   forces the creation  of necessary
          intermediate directories if they do
          not already exist.

     -u   copies an archive  file to a  target
          file even if the target is newer than
          the archive.  Normally, cpio does
          not copy the file.


__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

Reply via email to