N
N
Nikolay Baranenko2019-09-03 15:12:52
linux
Nikolay Baranenko, 2019-09-03 15:12:52

Why find: paths must precede expression?

I am writing a simple
bash question to search for files between minus 2 days and minus 1 day

DATE1=$(date -d "-2 days" +"%Y-%m-%d %k:%M:%S %z")
DATE2=$(date -d "-1 days" +"%Y-%m-%d %k:%M:%S %z")
find . -newermt $DATE1 ! -newermt $DATE2 -ls

I get the error
find: paths must precede expression
what's wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor Taran, 2019-09-03
@shambler81

But the fact that find already has a built-in algorithm + days - days does not bother you?
find. / -mtime +n
find ./ -mtime -n
Last resort file ./ -mtime +n -exec find -mtime -n file {} \;
What exactly are you trying to do?

S
SunTechnik, 2019-09-10
@SunTechnik

Run the command line in Bash.
In him ! this is the launch of the previous command, after which something completely different from what you typed is given for launch. Needs to be masked! .
find. -newermt $DATE1 \! -newermt $DATE2 -ls

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question