Delete Files Older Than x Days on Linux

Standard

Delete Files Older Than x Days on Linux
The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

Note that there are spaces between rm, {}, and \;

Explanation

The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.
This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

680 total views, 1 views today

Creating video thumbnails using ffmpeg

Standard

From: Creating video thumbnails using ffmpeg – Prashanth Ellina.

Creating video thumbnails using ffmpeg

Generating thumbnails/screenshots of a video is useful in many ways. Youtube and many other video sites use this to show a preview of the video as a small thumbnail. Google video captures a series of thumbnails from a video at various time intervals to show a better video preview.

There is a simple way to generate thumbnails in Linux using ffmpeg, a very very useful tool for processing videos. Let us generate a thumbnail for this video. Download the video and rename it to test.avi.

Then, run this command,

This command generates a 320×240 sized PNG thumbnail at the 4th second in the video. The output looks like this.
video thumbnail

If you do not have ffmpeg installed and are using Debian/Ubuntu, do,

A series of thumbnails, at 4, 8, 12 and 16 seconds.
video thumbnail
video thumbnail
video thumbnail
video thumbnail

useful links

753 total views, no views today