Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to find files which haven't changed within a specified period of time #982

Closed
Ultra-Code opened this issue Mar 13, 2022 · 2 comments · Fixed by #1176
Closed

How to find files which haven't changed within a specified period of time #982

Ultra-Code opened this issue Mar 13, 2022 · 2 comments · Fixed by #1176

Comments

@Ultra-Code
Copy link

What version of fd are you using?
[ fd 8.3.2 ]

I know that fd -tf --changed-within=4weeks . prints files in the current directory that have changed within 4week. how do i find those that haven't changed within 4week

@sharkdp
Copy link
Owner

sharkdp commented Mar 14, 2022

If you found --changed-within, why didn't you find --change-before? (serious question, I'm always looking for ways to improve documentation)

        --changed-before <date|dur>
            Filter results based on the file modification time. The argument
            can be provided as a specific point in time (YYYY-MM-DD HH:MM:SS)
            or as a duration (10h, 1d, 35min). '--change-older-than' or
            '--older' can be used as aliases.
            Examples:
                --changed-before '2018-10-27 10:00:00'
                --change-older-than 2weeks
                --older 2018-10-27

@Ultra-Code
Copy link
Author

@sharkdp Thanks , i saw --changed-before also but I just couldn't see how that was the inverse of --changed-within. I suggest this be mentioned in the man docs like

--changed-within date|duration
              Filter  results  based on the file modification time.  Files with modification times greater than the argument will be
              returned.  The argument can be provided as a duration (10h, 1d, 35min) or as a specific point in time in  either  full
              RFC3339  format  with  time zone, or as a date or datetime in the local time zone (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).
              --change-newer-than can be used as an alias for --changed-within .
              NOTE: --changed-before is the inverse of --changed-within .ie to get files that haven't changed within a specified 
              date|duration --changed-before is used.

              Examples:
                --changed-within 2weeks  #files that have changed within 2 week
                --change-newer-than "2018-10-27 10:00:00"  #files that have been changed after 2018-10-27 10:00:00

--changed-before date|duration
              Filter results based on the file modification time.  Files with modification times less than the argument will be  re‐
              turned.   The  argument  can  be provided as a duration (10h, 1d, 35min) or as a specific point in time in either full
              RFC3339 format with time zone, or as a date or datetime in the local time zone (YYYY-MM-DD  or  YYYY-MM-DD  HH:MM:SS).
              --change-older-than can be used as an alias for --changed-before.
              NOTE: --changed-within is the inverse of --changed-before .ie to get files/dir that have changed after a specified 
              date|duration --changed-within is used.

              Examples:
                --changed-before "2018-10-27 10:00:00" #files that where changed before 2018-10-27 10:00:00
                --change-older-than 2weeks  #changes that were made before 2weeks ago

Or
That another alias be made for either --change-within which will be called --changed-after or one be made for --changed-before which will be called --not-changed-within. I feel the confusion is coming from the fact that --changed-within and --changed-before sound like two completely different options so if my understanding of --changed-within and --changed-before are right then either of these new aliases will make the inverse relationship between the two options obvious so the NOTE: in the man pages suggested won't be required anymore , only the new alias would be mentioned which is self explanatory.

tmccombs added a commit to tmccombs/fd that referenced this issue Nov 15, 2022
And make some small tweaks to the help text and man page.

Closes: sharkdp#982
tmccombs added a commit to tmccombs/fd that referenced this issue Nov 21, 2022
And make some small tweaks to the help text and man page.

Closes: sharkdp#982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants