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


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

Posted on 2009-07-02
Medium Priority
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 46

Accepted Solution

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

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