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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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.

729 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