Link to home
Start Free TrialLog in
Avatar of lwfuk
lwfuk

asked on

How would I prune files that end in _batch_upload.csv?

Hi

I have a number of files in a directory called: /var/www/vhosts/test.com/httpdocs/results/

I would like to delete all of the files that end in: _batch_upload.csv

Here is an example of a real file: 3537732f540a1ac4298237f74c0928f5_batch_upload.csv

How would I do it via the command line?

Kind Regards,

Adrian Smith

ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A simple remove will work if there are no subdirectories.

rm -f /var/www/vhosts/test.com/httpdocs/results/*_batch_upload.csv


Or a recursive find

find /var/www/vhosts/test.com/httpdocs/results/ -name "*_batch_upload.csv" -delete
find  /var/www/vhosts/test.com/httpdocs/results/ -name \*_batch_upload.csv -exec rm {} \;
Avatar of lwfuk
lwfuk

ASKER

Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith