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

Posted on 2009-07-02
Last Modified: 2012-05-07

I have a number of files in a directory called: /var/www/vhosts/

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

Question by:lwfuk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 45

Accepted Solution

Kent Olsen earned 125 total points
ID: 24763168
Hi lwfuk,

The easiest is simply:

  rm /var/www/vhosts/*_batch_upload.csv

  cd /var/www/vhosts/
  rm *_batch_upload.csv

Good Luck,
LVL 40

Expert Comment

ID: 24763169
A simple remove will work if there are no subdirectories.

rm -f /var/www/vhosts/*_batch_upload.csv

Or a recursive find

find /var/www/vhosts/ -name "*_batch_upload.csv" -delete
LVL 68

Expert Comment

ID: 24763172
find  /var/www/vhosts/ -name \*_batch_upload.csv -exec rm {} \;

Author Closing Comment

ID: 31599185
Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

627 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