[Tfug] Need help with a complicated command line copy...

Brian Zaugg brian.zaugg at gmail.com
Wed Jun 27 17:10:55 MST 2007


Hi Jim,

The commands I sent would only keep the last copy found for a given filename.
If you want to flatten the directory structure and keep duplicates,
you'll need some scripting.
I can help with that if you need it.

-Brian


On 6/27/07, Jim March <1.jim.march at gmail.com> wrote:
> Brian, that last looks very usable.  One question though: how do I
> know it's keeping only the newest version of the file?
>
> Jim
>
> On 6/27/07, Brian Zaugg <brian.zaugg at gmail.com> wrote:
> > Hi Jim,
> >
> > Imagining that your friend's disk is mounted to /mnt/friend and you
> > are copying to /dest, something like this should work:
> >
> > find /mnt/friend \(-name *.pdf -o -name *.xls -o -name *.doc\) -exec
> > cp \{\} /dest\ \;
> >
> > The -exec syntax can be finicky depending on the platform, so this
> > might be easier:
> >
> > find /mnt/friend \(-name *.pdf -o -name *.xls -o -name *.doc\) -print
> > | xargs -i cp '{}' /dest
> >
> > Also, make sure and read the manpages for find and xargs first.
> >
> > -Brian
> >
> > On 6/27/07, Jim March <1.jim.march at gmail.com> wrote:
> > > Guys,
> > >
> > > I have a complicated problem.
> > >
> > > I have a stack of old hard disks with data a friend wants extracted.
> > > There are a lot of duplicates, and of course they're scattered across
> > > multiple subdirectories.
> > >
> > > The file types are as you'd expect: .pdf, .doc, .xls, etc.
> > >
> > > At the DOS command line I'd have trouble with this: I could use XCOPY
> > > to move the files (based on extension) from disk to disk including
> > > subdirectories, but In this case I don't WANT the target-location
> > > files to be in subdirectories.  Instead, as I pile the files into the
> > > target location I want to keep them all in one, and as new ones try
> > > and come in retain the one with the latest datestamp.
> > >
> > > I'm using standard Ubuntu Feisty so I figure there has to be a way to
> > > skin this cat at the command line, probably with standard tools but,
> > > maybe with some add-in package?  Any tips would be welcome :).
> > >
> > > Thanks!
> > >
> > > Jim
> > >
> > > _______________________________________________
> > > Tucson Free Unix Group - tfug at tfug.org
> > > Subscription Options:
> > > http://www.tfug.org/mailman/listinfo/tfug_tfug.org
> > >
> >
> >
> > --
> > -Brian
> >
> > _______________________________________________
> > Tucson Free Unix Group - tfug at tfug.org
> > Subscription Options:
> > http://www.tfug.org/mailman/listinfo/tfug_tfug.org
> >
>
> _______________________________________________
> Tucson Free Unix Group - tfug at tfug.org
> Subscription Options:
> http://www.tfug.org/mailman/listinfo/tfug_tfug.org
>


-- 
-Brian




More information about the tfug mailing list