You can modify the date & time in the above given command.
Delete files in a directory accessed before particular day
The below given command will help you to delete or remove files modified or accessed before particular days.
find path/of/the/file -type f -mtime +30 -delete
+30 in the above command represents the days. You can change as per your requirement, i.e, if you want to delete multiple files accessed before 10 days then +30 would be replaced with +10 in the above command.
#3. Command to delete multiple files with same keyword
With the command below you can delete all the files in a directory having same filename keyword. This means if you have multiple files having keyword new then you can use the below given command to delete them all at once.
rm -v keyword*
find -type f -name '*keyword*' -delete
Replace the keyword in above command with the one you want to delete. That means if you want to delete all the files having new in their filename, then you need to new in place of keyword in above command.
#4. Command to delete multiple files of same extension
The below command will delete multiple files with same extension. This can be done in two ways.
Delete files of same extension in a directory by using the below command.
You can modify the size of the file as per your choice.
That’s It !
Hope the article better describes the procedure to delete multiple files in Linux. Do share it with your colleagues if you find it working. Also share your suggestions and drop your queries to start the discussion on the related topic. Lets connect on social media with the below links.