[nflug] copy (cp) large number of files
Robert Meyer
meyer_rm at yahoo.com
Tue Apr 25 10:20:22 EDT 2006
Nope, wrong answer. If it can't handle the '*' for an argument list, it also
can't handle it as part of the 'for' loop. You will get the same error. I
think the limit is 32767 characters.
Cheers!
Bob
--- joshj at linuxmail.org wrote:
>
> Thus spake Robert F. Stockdale IV on Tue, 25 Apr 2006
>
> > Hello all:
> > I'm in the middle of reconfiguring my server. This box now runs
> > Gentoo with several scsi drives. I have three drives that I'm using LVM2 to
>
> > create 1 directory. This stores mostly music and video files. In order not
> to
> > loose any of the files I created an LVM partition out of 2 18G drives. I
> then
> > formated this with mkreiserfs and mounted it. I then tried to copy the
> nearly
> > full 36G ext3 drive to the newly created LVM drive. This is with the
> > intention of reformatting the ext3 drive with reiserfs and using it to
> extend
> > the LVM partition. However, when I tried to copy the files I got:
> >
> > cp /mnt/mus/multimedia/* /mnt/mus/
> > -bash: /usr/bin/cp: Argument list too long
> >
> > My son stop by and told me to use -R switch which did work at
> > copying. However, it also copied the directory. I want to be able to mount
> > this as /mnt/multimedia and then create the directories applicable for the
> > files used. If left in the current state it would mount ok but instead of
> > referring to the directory as /mnt/multimedia it would be
> > /mnt/multimedia/multimedia. So my question is: How can I get these into the
>
> > parent directory of the LVM partition without the "-bash: /usr/bin/cp:
> > Argument list too long " error message?
> > Thank you,
> > Bob
>
> If you have files foo1 foo2 and foo3 in a directory and you do:
>
> ls *
>
> That is the same thing as typing
>
> ls foo1 foo2 foo3
>
> Its the bash that interprets the "*" into all the files so the program
> (ls in this case) can understand it. There is an upper-limit to how many
> 'file arguments' you are allowed on the command line. Its quite a lot
> though. So the trick is to feed each file, one at a time, to the
> command. The shell is perfectly capable of this:
>
> for file in /olddir/*; do
> cp -R $file /newdir
> done
>
>
> -Josh
>
> > _______________________________________________
> > nflug mailing list
> > nflug at nflug.org
> > http://www.nflug.org/mailman/listinfo/nflug
> >
> >
> _______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug
More information about the nflug
mailing list