Removing Files via SSH Permalink: Removing Files via SSH
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.