This should work from the command line, make sure to replace the
/newdir/ with a proper path for you. Can use cp also. Make sure to type
this all on one command line.
for file in $(ls *.pdf); do mv $file /newdir/; done
Warning I can't test this with as many files as you have but this should
work.
Cheers,
Davidm
On Mon, 2002-12-09 at 14:15, Bill Earl wrote:
> Hello everyone!
>
> I need to copy, and occasionally move, some directories that contain
> thousands of files, (like around 250,000 pdfs), and the problem I'm
> having is that in the Bash shell, both cp and mv commands seem to die
> at somewhere around 3,000 files, so that if I enter
>
> cp /mydir/myfiles/*.pdf /newdir/
>
> I get the following error:
>
> bash: /bin/cp: Argument list too long.
>
> I noticed that even just trying to list this many files can cause this
> error, depending on the syntax used. "ls /mydir/myfiles/*.pdf"
> generates the Argument list too long error, but "ls /mydir/myfiles"
> displays fine.
>
> I can get around it using a python script and more fiddling around
> than I really want to do. I'd really like to be able to move these
> large numbers of files around just through the shell.
>
> Is anyone aware of a separate file copying or moving (I need to do
> both, depending on the situation) utility that can handle very large
> numbers of files? Would switching to a different shell solve this (if
> so, which one?), or is it a limit on the cp and mv commands?
>
> Thanks!
>
> Bill Earl
> Network Admin
> Spectrum Data Solutions, LLC
> www.bestbill.com
--
David IS Mandala
gpg fingerprint 8932 E7EF CCF5 1B8C 1B5C A92E C678 795E 45B2 D952
Phoenix, AZ (480) 460-7546 HP, (602) 321-8277 CP
http://www.them.com/~davidm/