We help IT Professionals succeed at work.

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

lwfuk
lwfuk asked
on
Medium Priority
311 Views
Last Modified: 2012-05-07
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

Comment
Watch Question

Data Warehouse / Database Architect
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Top Expert 2009

Commented:
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
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2013

Commented:
find  /var/www/vhosts/test.com/httpdocs/results/ -name \*_batch_upload.csv -exec rm {} \;

Author

Commented:
Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.