Re: [Q] Delete file get "parameter too long"

From: Bill Verzal (BVerzal_at_KOMATSUNA.COM)
Date: 04/27/04

  • Next message: Robert Miller: "Re: [Q] Delete file get "parameter too long""
    Date:         Tue, 27 Apr 2004 08:08:05 -0500
    To: aix-l@Princeton.EDU
    
    

    for file in `ls |xargs` ; do
       rm $file
    done

    Or

    for i in a b c d e f g...z ; do # you need to fill in all letters
       rm $i*
    done

    Take your choice.

    BV
    --------------------------------------------------------

    "If everything is coming your way, then you are in the wrong lane"

    Bill Verzal
    AIX Administrator, Komatsu America
    (847) 970-3726 - direct
    (847) 970-4184 - fax

                 "Harvey, Bruce
                 T."
                 <BTHarvey@LMUS.LE To
                 GGMASON.COM> aix-l@Princeton.EDU
                 Sent by: IBM AIX cc
                 Discussion List
                 <aix-l@Princeton. Subject
                 EDU> Re: [Q] Delete file get "parameter
                                           too long"

                 04/27/2004 07:45
                 AM

                 Please respond to
                      IBM AIX
                  Discussion List
                 <aix-l@Princeton.
                       EDU>

    1. Use the find command. But be absolutely certain either the directory
    you specify or the directory you're in. This would als remove files in
    lower directories, though, so be careful.

            Ex: find /mydir -type f -name "*somepattern*" -exec rm -f {} \;
    -print

    2. List the files into a temporary file, create a 'for' loop or 'while
    read' loop, then remove one at a time.

            Ex: ls >/tmp/myfile
                 for f in `cat /tmp/myfile`
                 do
                      rm -f $f
                 done

                 -or-

                 cat /tmp/myfile | while read f
                 do
                      rm -f $f
                 done

    Bruce T. Harvey
    Legg Mason Wood Walker, Inc.
    Corporate Technology - Mgr. UNIX Engineering
    11155 Red Run Blvd - Owings Mills, MD 21117-3256
    (410) 580-7383 -------- BTHarvey@LeggMason.com
    -----------------------------------------------------------

    -----Original Message-----
    From: bbb bb [mailto:mccux1@HOTMAIL.COM]
    Sent: Tuesday, April 27, 2004 8:29 AM
    To: aix-l@Princeton.EDU
    Subject: [Q] Delete file get "parameter too long"

    We have AIX 4.3.3 on RS6000. I tried to delte files and get "parameter too
    long". I need change to that directory to delete it.
    Does anyone know why and how to fix it?

    The procedures I do:

    $ rm /user1/dir1/*
    ksh: /usr/bin/rm: 0403-027 The parameter list is too long.
    $ ls -al /user1/dir1/*|wc -l
    ksh: /usr/bin/ls: 0403-027 The parameter list is too long.
           0
    $ cd /user1/dir1
    $ ls -lt|wc -l
        1042
    $ rm *
    $ ls -al
    total 232
    drwxrwxrwx 2 informix sys 22016 Apr 27 07:00 .
    drwxrwsrwx 16 informix sys 90624 Apr 27 06:01 ..

    Thanks.

    _________________________________________________________________
    Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage!
    http://join.msn.com/?pgmarket=en-us&page=hotmail/es2&ST=1/go/onm00200362ave/

    direct/01/

    IMPORTANT: The security of electronic mail sent through the Internet
    is not guaranteed. Legg Mason therefore recommends that you do not
    send confidential information to us via electronic mail, including social
    security numbers, account numbers, and personal identification numbers.

    Delivery, and timely delivery, of electronic mail is also not
    guaranteed. Legg Mason therefore recommends that you do not send
    time-sensitive
    or action-oriented messages to us via electronic mail, including
    authorization to "buy" or "sell" a security or instructions to conduct any
    other financial transaction. Such requests, orders or instructions will
    not be processed until Legg Mason can confirm your instructions or
    obtain appropriate written documentation where necessary.


  • Next message: Robert Miller: "Re: [Q] Delete file get "parameter too long""

    Relevant Pages