20

I want to remove files, more specifically, symbolic links of /usr/include that are newer than 2 JUN 22:27

How can I do this?

2 Answers 2

34

You might want to use find -newermt.

Make sure to review files to be removed first:

find /usr/include -type l -newermt "Jun 2 22:27"

Use -delete to perform actual removes.

find /usr/include -type l -newermt "Jun 2 22:27" -delete
2
  • 1
    Extra info, delete normal files from current directory, example: find . -newermt "Aug 3 5:27" -delete Aug 14, 2017 at 9:59
  • -type l didn't work instead I used -type f Apr 15, 2021 at 6:01
-1

I know the most voted solution may work for alott of people but it did not for me. I had to do it with unix timestamp.

 find . -type f -newermt "$(date -d @1494500000)" -delete

You can convert the timestamp easily with a unix timestamp converter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .