How to remove a directory using ssh?

Discussion in 'Site & Server Administration' started by bigrollerdave, Dec 5, 2006.

  1. #1
    I was just wondering what the command is to remove a directory and everything inside it. The file has over 4 gigs of pictures and sftp is taking way too long. Thanks
     
    bigrollerdave, Dec 5, 2006 IP
  2. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #2
    rm -rf [directoryname]
    Code (markup):
    remove a directory. You will be prompted to answer "Yes" or "No" for whether you would like to delete each file in the directory
     
    Richie_Ni, Dec 5, 2006 IP
    bigrollerdave likes this.
  3. bigrollerdave

    bigrollerdave Well-Known Member

    Messages:
    2,112
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    140
    #3
    thanks a lot
     
    bigrollerdave, Dec 5, 2006 IP
  4. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #4
    if you do

    man rm

    it will thow up a manual with all the shiz.
     
    SERPalert, Dec 5, 2006 IP
  5. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Please don't run this as root unless you need to.. because if you mis-type a directory you can really fubar the installation (recursive, scary!).
     
    CodyRo, Dec 5, 2006 IP
  6. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #6
    just-4-teens, Dec 5, 2006 IP
  7. Ferrarislave

    Ferrarislave Peon

    Messages:
    1,129
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Good suggestion, but he is obviously new to *nix. Running rm -rf in the wrong directory such as /home/ is basically hosing your entire server.

    man rm bigrollerdave ;)

    rm -r directoryname will be safer
     
    Ferrarislave, Dec 5, 2006 IP
  8. Seiya

    Seiya Peon

    Messages:
    4,666
    Likes Received:
    404
    Best Answers:
    0
    Trophy Points:
    0
    #8
    lol i can only think of everybodys reaction when all their files are gone, ouch that would suck... ;p
     
    Seiya, Dec 5, 2006 IP
  9. Ferrarislave

    Ferrarislave Peon

    Messages:
    1,129
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #9
    My friend has done it 2-3 times. Hosing 100+ hours of programming and 3-4 entire websites and databases. ;) I am terifyed of rm -rf.
     
    Ferrarislave, Dec 5, 2006 IP
  10. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #10
    He wanted to remove all the files in that directory,so it's easier.

    Sorry I posted something wrong,there's no prompting when you use the command.
     
    Richie_Ni, Dec 5, 2006 IP