Posts Tagged ‘centos’

Be careful when using find with the delete flag to clean old files.

January 9th, 2012 3 comments

The linux find command is very powerful. I use it all the time, either manually or in cron scripts to delete useless Thumbs.db files for example. A word of caution however, if you intend on using the -delete flag with find (instead of -exec rm… or xargs etc.).

This is very bad:

find / -delete -type f -name 'Thumbs.db' -mtime +7

This is good:

find / -type f -name 'Thumbs.db' -mtime +7 -delete

The order of the -delete flag is very important. In the first case find will delete everything it finds (totally ignoring the subsequent criteria), whereas the second case will delete what is matched.

In other words, the order of the find flags/parameters/actions are very important. If you are in doubt, or even if you are not, you should always have a backup in case something goes wrong.
Read more…

If you have problems adding rpmfusion repos to your distro…

June 21st, 2011 1 comment

Whilst installing a fresh copy of Fedora Core today, I found that the repo mirror was not responding. A quick google search provides the solution. Simply replace download1 with download2 in the URL.

For instance (depending on your distro), instead of:

su -c ‘yum localinstall –nogpgcheck’


su -c ‘yum localinstall –nogpgcheck’