To delete all files and folders in the current directory via SSH

14/10/2006 :

To delete all files and folders in the current directory via SSH, you can use the “rm” command with the “-r” and “-f” flags.

The “-r” flag, which stands for “recursive,” tells the command to remove the directory and all its contents. The “-f” flag, which stands for “force,” tells the command to delete the files and folders without prompting for confirmation.

Here is an example of how to use the command:

$ rm -rf *

This command will delete all files and folders in the current directory and its subdirectories, without asking for confirmation.

This command will permanently delete all files and folders in the current directory with no warning or confirmation. Make sure you have a backup of the files and folders you want to delete, or that you are in the correct directory before running this command.

To avoid any mishaps, check the current directory and the files you want to delete before running any command, and make sure that the directory you want to delete is empty.

Alternatively, you can use the “find” command to delete files based on their extension, for example:

$ find . -name "*.log" -delete

This command will find all files with .log extension in the current directory and delete them all.

Please be cautious when using this command, as it will delete all files that match the specified criteria with no confirmation.

It’s always a good idea to make sure you have a backup of the files you want to delete before proceeding.