Removing Files via SSH Bookmark

I needed to delete a lot of files from a web server and it was taking forever. To get this done faster, I looked into removing the files via SSH. The following handy lines of code let you find or delete all files and folders within a certain directory.

To find all files and folders at least one level deep in the specified directory, type:

find <name-of-directory or path> -mindepth 1

To delete all files and folders inside the specified directory, type this:

find <name-of-directory or path> -mindepth 1 -delete

As always, use this command with caution.

Leave a comment

Available formatting commands

Use Markdown commands or their HTML equivalents to add simple formatting to your comment:

Text markup
*italic*, **bold**, ~~strikethrough~~, `code` and <mark>marked text</mark>.
- Unordered item 1
- Unordered list item 2
1. Ordered list item 1
2. Ordered list item 2
> Quoted text
Code blocks
// A simple code block
// Some PHP code
[Link text](
Full URLs are automatically converted into links.

Replied on your own website? Send a Webmention!