How to delete all files in one particular directory

85 Views Asked by At

In Linux, how can I delete all files in particular directory? For example /home/xd/karthik is my path; I want to delete all files in the above directory, if the disk usage exceeds 90%. How can I write a script for that?

1

There are 1 best solutions below

0
On

rm /path/to/directory/*

add rm -r to remove the file hierarchy rooted in each file argument.

dont need script just basic shell command