≡ Menu

Linux / UNIX: Deleting Files In Many Subdirectories

How do I delete all files (only files and not subdirs) located in /var/pub/ftp/incoming and its subdirectories under Linux or UNIX operating systems?

You can use any one of the following command:
# Reply Link

  • dude May 14, 2013, 9:28 am

    No! That command does not do what you think it does.

    Your version: xargs rm -rf *.*
    is NOT tied to what is found by the find . -name part. If someone took that command as a template but instead of find *.* did something like find myfile123.*, your command would still delete everything, not just myfile123.*.

  • tesla October 24, 2013, 1:46 pm

    Thanks a lot, that worked out very well.

  • Security: Are you a robot or human?

    Leave a Comment

    You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">