Recursive Copy?
Kurt Wall
kwall
Tue Aug 8 19:11:48 PDT 2006
On Tue, Aug 08, 2006 at 12:47:01PM +0000, Steve Jardine wrote:
> All,
>
> I need to copy a group of directories recursively into a single directory. I need to make sure that no files
> overwrite each other. I would like to have each duplicate file name appended with a number to make them unique.
>
> Anyone got a utility like this? Or an idea?
One-line close approximation of an answer:
$ cp -rv --backup=numbered dir1/* dir2/* newdir
`dir1/grape_maters.png' -> `newdir/grape_maters.png'
`dir1/hpim0639.jpg' -> `newdir/hpim0639.jpg'
`dir1/hpim0639.png' -> `newdir/hpim0639.png'
`dir1/hpim0669.jpg' -> `newdir/hpim0669.jpg'
`dir2/GRAPE_MATERS.PNG' -> `newdir/GRAPE_MATERS.PNG'
`dir2/hpim0639.jpg' -> `newdir/hpim0639.jpg' (backup: `newdir/hpim0639.jpg.~1~')
`dir2/hpim0639.png' -> `newdir/hpim0639.png' (backup: `newdir/hpim0639.png.~1~')
`dir2/hpim0669.jpg' -> `newdir/hpim0669.jpg' (backup: `newdir/hpim0669.jpg.~1~')
KUrt
More information about the Linux-users
mailing list