Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Delete all files within a folder?

Discussion in 'General Discussion' started by prettydumb, Aug 30, 2007.

  1. prettydumb

    prettydumb Active Member

    Joined:
    Aug 25, 2007
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    56
    is this the correct linux format to delete all files within the /cur/ folder without deleting cur?

    I have an account which has 10 gig of email and I want to delete all emails.

    rm /home/user/mail/cur/*
     
    #1 prettydumb, Aug 30, 2007
    Last edited: Aug 30, 2007
  2. nyjimbo

    nyjimbo Well-Known Member

    Joined:
    Jan 25, 2003
    Messages:
    1,129
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    New York
    10 GIG is alot and it might not work on a single wildcard delete. You might have to cd to /home/user/mail/cur/ and then do a "ls" to see what the file names are and delete them in chunks like "rm 1187*" "rm 1188*" and so on.

    also if the size of the mailbox usage remains high you might need to delete the maildirsize file, see this thread:

    http://forums.cpanel.net/showthread.php?t=68409&highlight=maildirsize
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 nyjimbo, Aug 30, 2007
    Last edited: Aug 30, 2007
  3. prettydumb

    prettydumb Active Member

    Joined:
    Aug 25, 2007
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    56
    When you say "chunks"...

    Is this a chunk? 1187* rm1197*

    Would this mean I were deleting a "chunk" of ten files?

    If so, would the correct linux command be /home/user/mail/cur/1187* rm1197*
     
  4. nyjimbo

    nyjimbo Well-Known Member

    Joined:
    Jan 25, 2003
    Messages:
    1,129
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    New York
    If you try to do a mass delete and there are too many it might say something about the file list being too big and it wont delete anything. Doing a "rm 1187*" might be deleting hundreds of files are they are LONG file names.

    Go into the cur directory and do a :

    ls|wc

    which will list the files to a counter and print out a count (the leftmost number in the output is the count of files in the folder). If its small then you should just be able to delete them with the "rm *" but PLEASE be sure you are in the right folder or you could kill your machine.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice