Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-02
4
Medium Priority
?
269 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
[X]
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
4 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 500 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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

721 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