How to delete files from specific folders in linux?

Viewed 107

So, I have a requirement to delete all files from specific folders within a directory. These are folders that end with "-outputs" in their names and I need to delete all files in those particular folders.

Is there a command in linux that lets you do that?

1 Answers

You can execute the following command:

rm $YOUR_PATH\*-outputs

Change $YOUR_PATH to the path where the files are located.

If you want to ignore nonexistent files and arguments, and avoid the prompt, you can use the -f option.

rm -f $YOUR_PATH\*-outputs

You can see the different rm options here: rm Linual manual page

Related