S
S
Salavat Sitdikov2013-06-03 12:12:23
bash
Salavat Sitdikov, 2013-06-03 12:12:23

Find find in unix environment and exclude directory. How to do?

You need to get all new files (created or modified in the last month) from the /home/user/subdir/ folder, but exclude the ./tmp folder (/home/user/subdir/tmp).

I try the following request - well, it doesn't work.

find /home/user/subdir/ -ctime -30 \( -path/home/user/subdir/tmp \) -prune -o -print > /root/new_files.txt

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
avalak, 2013-06-03
@zona7o

find /home/user/subdir/ -path /home/user/subdir/tmp/ -prune -o -ctime -30 -type f > /root/new_files.txt

S
Slipeer, 2013-06-03
@Slipeer

Try like this:

find /home/user/subdir/ -ctime -30 -and -not \( -path /home/user/subdir/tmp -prune \)  -print > /root/new_files.txt

S
Salavat Sitdikov, 2013-06-03
@zona7o

missed

B
betal, 2013-06-03
@betal

grep -v
as a last resort.

V
Viktor Taran, 2014-02-07
@shambler81

find. -30 -print

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question