Delete files and folders via SSH

To delete a file using SSH, you’ll need to execute the appropriate command – rm.

The command looks like this:

rm myFile.txt myFile1.txt myFile2.txt …etc…

However, listing all files/folders that need to be deleted can be quite time consuming. Fortunately rm accepts several arguments which can make your job easier. In the above example you could type:

rm myFile*.txt

This will match all files starting with ‘myFile’ and ending in ‘.txt’

To delete a whole folder and its content recursively, you can use:

rm -rf foldername/

To delete all files/folders in the current directory without deleting the directory itself, you would need to use:

rm -rf *

currently there's 2 comment(s)

  • Zachary

    commented on June 25, 2015 at 12:15 pm

    Hello, I need some help with it. When I try to go to magento front page it pops up this: Warning: smpmlexil_load_string(): Entity: line 2: parser error : Comment not terminated. Nothing is shown in system.log about this as well. I don’t know where to put Mage::log(print_r($filename, true)); to help me find this error.Help please.

    Reply
    • Michael Savin

      commented on July 7, 2015 at 10:58 am

      Apologies, just saw this now. Do you still need help with this?

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *