The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

delete all files under a folder

Discussion in 'General Discussion' started by mihaio, Jan 27, 2008.

  1. mihaio

    mihaio Registered

    Joined:
    Jan 27, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I'd like to clean up some space, for example from
    tmp/analog and tmp/urchin as I'm getting close to the maximum disk quota for my hosting account.

    I tried to look for it, I searched this forum as well but I do not know how to delete all files under a folder (I do not want to go one by one as there are too many) .

    "Delete this folder and all files under it" is a command I do not want to use as I do not know whether those folders are required or not.

    To cut a long story short is there a way to delete all files under a folder at once ?

    Thanks
     
  2. sitekeeper

    sitekeeper Well-Known Member

    Joined:
    Aug 13, 2001
    Messages:
    60
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Troy, Mo
    rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it
    rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
    rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!!

    Bob
     
  3. mihaio

    mihaio Registered

    Joined:
    Jan 27, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Sorry I was not too clear; I am using CPanel so a line command won't work
    (I think so).
     
  4. sitekeeper

    sitekeeper Well-Known Member

    Joined:
    Aug 13, 2001
    Messages:
    60
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Troy, Mo
    The file manager in cpanel should work.. But you may not be able to delete some things in /username Be sure to empty the trash once your sure you have everything deleted correctly.

    Bob
     
  5. mihaio

    mihaio Registered

    Joined:
    Jan 27, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Yes, it works but is there a way to delete all files at once under a folder not to go one by one ?
     
    #5 mihaio, Jan 29, 2008
    Last edited: Jan 29, 2008
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you are using the X3 theme and "File Manager", you should be able to delete all contents of a folder by dragging a box around all the files/folders you wish to delete rather than deleting one at a time.

    This cannot be done using Legacy File Manager or the File Manager in the old X and X2 themes.
     
Loading...

Share This Page