User Tools

Site Tools


find

This is an old revision of the document!


Find

To find all files that was modified since a specific time ago
(i.e an hour ago, a day ago, 24 hours ago, a weeks ago and so on) in Unix environment,
the find command will come in handy. The command syntax is:

To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:

| cmd
find . -mtime -1 -print

Flag -mtime -1 option tells find command to look for files modified in the last day (24 hours).
Flag -print option will cause find command to print the files’ location.
-print can be replaced with -ls if you want a directory-listing-type response.

To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:

| cmd
find /directory_path -mtime -1 -print

The command is basically the same with the earlier command,
just that now you no need to cd (change directory) to the directory you want to search.

To find all files with regular file types only,
and modified in the last 24 hours (last full day) in current directory and its sub-directories:

| cmd
find /directory_path -type f -mtime -1 -print

To find all files that are modified today only (since start of day only, i.e. 12 am),
in current directory and its sub-directories:

| cmd
touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$

The first command can be modified to specify other date and time,
so that the commands will return all files that have changed since that particular date and time.

find.1245799815.txt.gz · Last modified: 2020/08/10 02:30 (external edit)