Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Copy file to multiple destinations with one read operation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
thomasvk
Guru
Guru


Joined: 19 Mar 2005
Posts: 597

PostPosted: Sun Apr 26, 2009 4:39 pm    Post subject: Copy file to multiple destinations with one read operation Reply with quote

Does a tool exist to copy from one source to multiple destinations, with just one read operation? For example if I have a source (file or directory, doesn't matter) of 5GB it would take 10 minutes to copy it to one destination and then another 10 minutes to copy to another destination. However, if the source blocks are just read once, and then those blocks are written to the two destination locations simultaneously it would only take 10 minutes in total. I realize this would only be beneficial where the multiple destinations are actually on separate media (which is the case for me).

Of course in this example it's quite trivial but for me it's about several hundreds of gigabytes and takes multiple hours to copy, it would really save time: it would only take as long as the slowest destination volume.
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Sun Apr 26, 2009 5:52 pm    Post subject: Reply with quote

Just cat the file to tee, which will copy it's input to as many output files as you specify.

Recursively copying will be trickier, but a shell script should work nicely.

I'm pretty sure I've seen a thread about this a few months ago, try searching for tee.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
MaximeG
l33t
l33t


Joined: 15 Apr 2008
Posts: 722
Location: Belgium

PostPosted: Sun Apr 26, 2009 6:07 pm    Post subject: Reply with quote

Yes,

dev-perl/IO-Tee should help you.

Although it would not be that simple to improve file operations speed. Only raid* are efficient for that kind of stuff.

Regards,
Maxime
_________________
Future is wide open.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum