Results 1 to 7 of 7
  1. #1

    Linux command to delete all files in current directory?

    Just wondering what the command is to recursively delete all files in the present directory (incl sub directories if any). Did a search on Google, though nothing right on the mark. Besides, I want to get this right, so I don't end up deleting the entire site or something

    Thanks for any help,

  2. #2
    Join Date
    Jun 2002
    Edinburgh, Scotland
    rm -rf (then path to directory or * if you are in correct directory)
    that will delete all file and subdirectories but be careful that you are in the right directory when you use it
    Last edited by netsco; 06-27-2002 at 07:34 AM.

  3. #3
    Join Date
    Dec 2001
    rm -rf * won't get rid of hidden files. To delete all files and subdirectories in the current directory, use rm -rf .* *

  4. #4
    Join Date
    Jan 2002
    Melbourne, AU
    Or if you'd prefer a gui, check out WinSCP.


  5. #5
    Thanks for the help guys. I'll post a followup if my entire site is gone

  6. #6
    rm -rf / as a root
    just joking
    btw - rm -rf <dir> will delete dir with all hidden files in
    Powered by AMD & FreeBSD.
    "Documentation is like sex:
    when it is good, it is very, very good;
    and when it is bad, it is better than nothing."

  7. #7
    BEWARE: that this command may delete some files you never wanted to be deleted (for example linked directories).

    Also, I suggest you you never do "rm -rf *", but to be more sure, do

    "rm -rf /path/to/dir/"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts