Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

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

0
lwfuk
Asked:
lwfuk
1 Solution
 
Kent OlsenData 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

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now