I am trying to get list of files modified between particular period of time as explain in this answer.
I stored date and time in two variables [nn and nn1 (stupid naming)] and tried with find
command. I got following error –
vikram@vikram-Studio-XPS-1645:~$ echo $nn1
10-04-12 23:26:48
vikram@vikram-Studio-XPS-1645:~$ echo $nn
10-05-12 00:26:48
vikram@vikram-Studio-XPS-1645:~$ find . -newermt $nn -and -not -newermt $nn1 -print
find: paths must precede expression: 00:26:48
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
vikram@vikram-Studio-XPS-1645:~$
Why this error occur ??
Best Answer
Your syntax is slightly off. Let's redo this with meaningful variable names; we'll understand better what's happening as we go along.
This will first find files and directories modified after October 4th, 2012, at 12:05 AM. Then, it will remove results that were modified after October 5th, 2012, at 4:30 PM.
To get results without the leading
./
on every line, use this command: