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

lwfukAsked:
Who is Participating?
 
Kent OlsenConnect With a Mentor Data Warehouse Architect / DBACommented:
Hi lwfuk,

The easiest is simply:

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

or
  cd /var/www/vhosts/test.com/httpdocs/results/
  rm *_batch_upload.csv


Good Luck,
Kent
0
 
mrjoltcolaCommented:
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
0
 
woolmilkporcCommented:
find  /var/www/vhosts/test.com/httpdocs/results/ -name \*_batch_upload.csv -exec rm {} \;
0
 
lwfukAuthor Commented:
Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith
0
All Courses

From novice to tech pro — start learning today.