Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Aug 2007
    Posts
    35

    Default Delete all files within a folder?

    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/*
    Last edited by prettydumb; 08-30-2007 at 07:59 PM.

  2. #2
    Member nyjimbo's Avatar
    Join Date
    Jan 2003
    Location
    New York
    Posts
    1,105

    Default

    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....ht=maildirsize
    Last edited by nyjimbo; 08-30-2007 at 08:39 PM.
    "A dog has raised it’s hind leg on the age of nevermore !"
    -- Rolf

  3. #3
    Member
    Join Date
    Aug 2007
    Posts
    35

    Default

    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. #4
    Member nyjimbo's Avatar
    Join Date
    Jan 2003
    Location
    New York
    Posts
    1,105

    Default

    Quote Originally Posted by prettydumb View Post
    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*
    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.
    "A dog has raised it’s hind leg on the age of nevermore !"
    -- Rolf

Similar Threads & Tags
Similar threads

  1. Can't delete a folder
    By masterfujin in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-07-2011, 12:48 PM
  2. Can't Delete Files ot Folder
    By Possumnz in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-04-2008, 05:48 PM
  3. delete all files under a folder
    By mihaio in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 01-30-2008, 10:03 AM
  4. Dont delete this folder - folder interal data
    By ozzi4648 in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 06-27-2006, 10:18 AM
  5. I Can Delete /var/log/ this folder inside any files
    By lung3 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-12-2002, 11:59 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube