Solved

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

Posted on 2009-07-02
4
255 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

0
Comment
Question by:lwfuk
4 Comments
 
LVL 45

Accepted Solution

by:
Kdo earned 125 total points
Comment Utility
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
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
find  /var/www/vhosts/test.com/httpdocs/results/ -name \*_batch_upload.csv -exec rm {} \;
0
 

Author Closing Comment

by:lwfuk
Comment Utility
Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now