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
LVL 45

Accepted Solution

Kdo 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Postfix issues with spam/auth attempts under NAT 9 81
capture pcap with filtered traffic 1 59
Setting up Two Three NICs with One on a Different Subnet 22 76
centos linux 65 123
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

813 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

15 Experts available now in Live!

Get 1:1 Help Now