Re: ksh: Copying files one by one
From: aleatory (aleatory_at_hotmail.com)
Date: 04/10/05
- Next message: Juhan Leemet: "Re: sed: delete different characters"
- Previous message: John B. Matthews: "Re: Converting Java batch file from windows to unix format"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 10 Apr 2005 07:23:27 -0700
Hi Markus, Chris, and Bill
Thanks for misc. tips on copying files!
I first implemented using Bill's advice, and then I
finally finished creating my script following misc.
advice by Markus and Chris.
Even though my script is still a bit buggy, you guys
definitely gave me great ideas! :)
Thanks again,
Kise
Bill Seivert <seivert@pcisys.net> wrote in message news:<423E1ADE.5040806@pcisys.net>...
> aleatory wrote:
> > Hi all,
> >
> > How could I accomplish the following with looping in a
> > ksh shell?
> >
> > cp -p file* /tmp
> >
> > Well, if the cp command worked with 1,000 files, I
> > would be asking this question; however, I get an error
> > message saying "Too many arguments" when I execute the
> > cp command.
> >
> > My current ksh shell script looks like:
> >
> > | #/usr/ksh
> > |
> > | cd /home/alea/tmp/
> > | # count=ls -l file* | wc -l # Not sure about this but I think
> > | # I need how many time I have to
> > | # continue looping
> > |
> > | for i in count
> > | cp -p ???? /tmp # don't know the exact syntax...
> > | done
> >
> > Any enlightment is highly appreciated.
> >
> > Many thanks in advance,
> >
> > alea
> You could try something like this:
>
> cp -p file[A-Ma-m]* /tmp
> cp -p file[N-Zn-z]* /tmp
> cp -p file[0-9]* /tmp
> and handle any special characters, also.
>
> If these still return too many arguments, split them into
> smaller groups, e.g., a-h, i-p, q-z, etc.
>
> Or use find:
> find . -name "file*" -exec cp -p {} /tmp \;
>
> Bill Seivert
- Next message: Juhan Leemet: "Re: sed: delete different characters"
- Previous message: John B. Matthews: "Re: Converting Java batch file from windows to unix format"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|