Solved

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

Posted on 2009-07-02
4
265 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
ID: 24763168
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
ID: 24763169
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
ID: 24763172
find  /var/www/vhosts/test.com/httpdocs/results/ -name \*_batch_upload.csv -exec rm {} \;
0
 

Author Closing Comment

by:lwfuk
ID: 31599185
Hi Kent

Many thanks for a fast response.

Kind Regards,

Adrian Smith
0

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