dummie ksh

Please help me with a newbie ksh question:

I want a script in ksh (under Solaris 8 - SPARC) who runs a "ls -lR" command in some directory and it looks after all the files with the same date as the current one and/or created in the last 24 hours (or N hours).

The script should do:

  • if no files with the same date were found display "no new files found..."
  • otherwise display "new files found..." and also all the lines (only those lines from my "ls -lR" command)
    and/or
    the same for the files created in the last N hours.

I thought this is very easy but I encountered difficulties when I tried to avoid displaying files with the same day, month but not the same year...

BTW the part with "the same date" might be done in one line command?

You could try this link to find files older than particular number of days. Instead, of 30 you could try 1 day old. or any number of days you want to.

or

You could try to find a particular date using date calcand then try this link

Try this:

ls -l $(find . -type f -mtime -1)

This is not going to work where there are lots of files, you'll receive an argument list that is too long.

Try

$ find . -type f -mtime -1 -print0 | xargs -0 ls -l

Cheers
ZB