Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: copying a million small files between disks?
- X-seq: zsh-users 12157
- From: "Christopher Browne" <cbbrowne@xxxxxxxxx>
- To: "sam reckoner" <sam.reckoner@xxxxxxxxx>
- Subject: Re: copying a million small files between disks?
- Date: Wed, 31 Oct 2007 21:41:53 -0400
- Cc: zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=RzkqmYOjCkLR0fI7b6/NMFih207YN6UYx/zrAYBuVsQ=; b=gWHsE9dcppnyEyIpqBjSkheKddrygjSdD1f8xtlKKNwCWTevgph7+rGiS1ggiCYFmdVITiFKi1Mc22y6x5zxYvt/Cl8n0X7kxc2zDGhsPWPV4gWHR7247LfuO6RnmJL2zynwYBCDOazMw3230KGkdX1FMXaMeKE4Gpg1Kd6q1fc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FpFqsc9+YuoY6uVAlaN/6cT8FE23Qzu4BAsf8r3WKqMul+wMjLALJKkeoP9jYNgsy8Ccs3MSYYVW6P/aL5xGTuYijpWtRT54FP6qs1zAbFsgOQPHE8+5BhabVmqG6U7aGLfrC/RRmnsKCcX2Edq8HuS39IyiRfxLk6fejAOqLM4=
- In-reply-to: <6a42eec70710311440u52556985wda68ce326f4a0417@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <6a42eec70710311440u52556985wda68ce326f4a0417@xxxxxxxxxxxxxx>
On 10/31/07, sam reckoner <sam.reckoner@xxxxxxxxx> wrote:
> I'm not exaggerating. I have over one million small files that like to
> move between disks. The problem is that even getting a directory
> listing takes forever.
>
> Is there a best practice for this?
>
> I don't really need the directory listing, I just need to move all the
> files. I have been using rsync, but that takes a very long time to
> generate the list of files to be moved.
>
> Any alternatives?
Yeah, I'd use find.
The fundamental problem with ls, which you're clearly running into, is
that when there are a million files, not only do you:
a) Have to read the directory entries, but
b) They will all have to be read into memory (in some form of array), and
c) Then they get sorted (presumably generating a *second* array,
though possibly not).
You're getting your lunch eaten by b) and c).
You might try:
"find /path/where/all/the/files/are | xargs cp -I {}
/path/that/is/destination"
That will skip steps b and c.
--
http://linuxfinances.info/info/linuxdistributions.html
"... memory leaks are quite acceptable in many applications ..."
(Bjarne Stroustrup, The Design and Evolution of C++, page 220)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author