Solved

Deleting files bigger than and/or older than

Posted on 2004-04-24
1
427 Views
Last Modified: 2013-12-16
hi I can finger out the command to a delete all files in a directory bigger that say 40k except one over 40k called image.jpg
And similarly files in a directory older than 20 days say except the same file

thanks greenbug2000

0
Comment
Question by:greenbug2000
1 Comment
 
LVL 40

Accepted Solution

by:
jlevie earned 125 total points
ID: 10908150
You can identify all files older than 20 days in a directory or its sub dirs except image.jpg with:

find some-dir -type f -not -name image.jpg -ctime +20

and to the delete those add "-exec rm [] \;" to the command, like:

find some-dir -type f -not -name image.jpg -ctime +20 -exec rm {} \;

In a like manner replacing "-ctime +20" with -size 40k should remove all files 40k or more except image.jpg.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

19 Experts available now in Live!

Get 1:1 Help Now