Solaris files created within directory in last 15min.

I have a directory on a Solaris box that has 58 files written to it every 15min. They have a non standard date as part of the file name but always have another name with it. I need to check that directory for files created within the last 15min and then port the results to a log file. There are thousands of files but should only be and up to 58 within the last 15min. Wish there was ls for it but I can't find any. Anyone got a script or knows of a command?

Thanks,
Jaime

There is a serious lack of detail in this post.
What version of Solaris?
What Shell do you use?
What are the filenames? Any special name for the LAST file to be transferred in a batch of files?
How long does it take to create the "up to 58 files"? Let's hope that it is nowhere near 15 mins?
How often do you need to check?
Why are you doing this?

As posted, this task is impossible to program. However you approach it there is a good chance of hitting a point part-way through a batch of file transfers.

Suggest you consider changing the process such that subsequent processing is feasible. Creating a zero-length "started" file at the start of each batch of files and a zero-length "finished" file at the end of each batch is a good method for delimiting batches with timestamped files.
As for commands, let's see what your environment is and how often you need to check. We shall assume throughout that you are the root user and have full permissions to create cron jobs.

Unfortunately the amin, mmin and cmin options are not supported in the Solaris version of find.

With some tweeking, this workaround using Perl might work for you: Find files modified in the last hour

find will work

# assume    15 minutes ago
a=$( date +%H%M )
a=$(( $a - 15 ))
touch -t $a /tmp/dummy1
find /path -newer /tmp/dummy1 -exec ls -l  {} \;

you can compute that value but it will not work if you run this just after midnight.

1 Like

I get a time error?

bash-3.00$ more testing.sh 
# assume    15 minutes ago
a=$( date +%H%M )
a=$(( $a - 15 ))
touch -t $a /tmp/Spirent_TCL/testing.log
find /spirent/metro/escout/exportData/data -newer /tmp/Spirent_TCL/testing.log -exec ls -l  {} \;
bash-3.00$ 
bash-3.00$ 
bash-3.00$ ./testing.sh 
touch: bad time specification
bash-3.00$ date
Thu Sep 20 16:37:12 GMT 2012
bash-3.00$ date +%H%M
1637
bash-3.00$ uname -a
SunOS tclsnq01 5.10 Generic_144488-17 sun4v sparc sun4v
bash-3.00$

You can't use just hours and minutes as argument to the -t option. Usage is:

-t [[CC]YY]MMDDhhmm[.SS]
1 Like