Results 1 to 4 of 4

Thread: Argument list too long : Deleting files older than today

  1. #1
    Join Date
    Jul 2009
    Posts
    188

    Argument list too long : Deleting files older than today

    Hi,

    I am trying to split up a huge directory based on the modified date of the files within but it gives me an error : -bash: /bin/rm: Argument list too long. I've been using "find" with the -exec parameter to remove files that are older than a date older than today. I need to delete file(cookies.html) from the path(/usr/temp).

    Can u provide the command for the above query

  2. #2
    Join Date
    May 2008
    Posts
    249

    Re: Argument list too long : Deleting files older than today

    One solution is to to either run rm command inside a loop and delete each individual result, You can use zsh command to delete file(cookies.html):

    Code:
    rm -- /usr/temp/**/cookies.html(mh+24)

  3. #3
    Join Date
    May 2008
    Posts
    230

    Re: Argument list too long : Deleting files older than today

    The -exec will execute something, substituting the {} with the current file name, the\; ends the execute parameters, -print will print the filename on the console.

    Code:
    find /var/lock -type f -print0 | xargs -0 rm -f -- 1>&2

  4. #4
    Join Date
    May 2008
    Posts
    244

    Re: Argument list too long : Deleting files older than today

    Try:

    Code:
    rm -rf file[1-5]*.txt
    rm -rf file[6-9]*.txt
    Or

    Code:
    rm -rf file1*.txt
    :
    rm -rf file9*.txt
    If not :

    Try `rm --help' for more information.

Similar Threads

  1. deleting files where the filename is too long
    By Jhal in forum Vista Help
    Replies: 5
    Last Post: 04-02-2013, 07:46 AM
  2. Replies: 6
    Last Post: 17-08-2010, 05:02 AM
  3. delete files older than...
    By Hugo in forum Windows Server Help
    Replies: 5
    Last Post: 21-05-2010, 03:18 PM
  4. Replies: 1
    Last Post: 24-08-2009, 09:47 PM
  5. rm files older than two days
    By Adonis in forum Windows Software
    Replies: 3
    Last Post: 23-06-2009, 07:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,699,134.64830 seconds with 17 queries