Re: ksh: Copying files one by one

From: aleatory (aleatory_at_hotmail.com)
Date: 04/10/05


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



Relevant Pages

  • Comparison Script Components with Script Classes
    ... Now I would like to have some advice from more experienced programmers. ... I do not really figure out, how the concepts of Script Components and Script Classes differ and for what use cases they are intended. ... How do you build your strictly object-oriented libraries in VBScript? ...
    (microsoft.public.scripting.vbscript)
  • Re: Using $_POST with Submit button
    ... > I wondered if anyone could further advice? ... In my script I was ... are both on the same script, this is the way of detecting when $_POST ... Visit Topic URL to contact author (reg. ...
    (comp.lang.php)
  • Re: aborting a bash script with control-c
    ... You get advice for free, ... where we invoke system- running a very short execution time ... script - for every line in the input. ...
    (comp.unix.shell)
  • Re: Trouble with system() function
    ... > Thanks for the advice. ... if I run that part of the script from the command ... can't guarantee it. ... / without MD5 usage) from my example instead of your code you have ...
    (comp.lang.php)
  • Re: Scripting for AD
    ... > I am looking to run a batch script that will create in excess of 100 ... > in Active directory and place them in specific groups with a specific ... > password and also run a specific script for each user and also create ... Hello misc, ...
    (microsoft.public.windows.server.active_directory)