-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
Option to include current directory #364
Comments
Pedantic: the "-a" option for ls also shows the parent directory ".." and includes hidden (dot) files. What is the use case for this? |
Closing this, as there is no further feedback. |
@sharkdp apologies - i didnt realize feedback was needed we already have we could introduce an option please reopen - thank you |
Ok. Could you please tell us what your use case is? |
Just because another program does something a certain way, doesn't necessarily mean it is valuable. Adding functionality just because that's the way find does it seems like wasted effort to me. Personally I have never needed find or ls to include the current directory, and have sometimes had to exclude it when piping it to another command. Have you found that functionality useful? If so, for what kind of things? |
Ok, I'm going to close this for now. I still don't see the need for this, and there are simple ways to work around this in scripting ( |
@sharkdp I remembered my use case - ok with find say you want to operate on a subtree, you can do this: $ find gamma
gamma
gamma/delta
gamma/epsilon.txt and then find gamma -exec SOMETHING and it will operate on everything including gamma - but FD cant do this, see: $ fd --search-path gamma
gamma\delta
gamma\epsilon.txt so can we reopen this issue? |
Sorry to be insistent here: what is |
@sharkdp i would really rather not divulge, as i dont want this issue to be pigeonholed or judged on just the basis of whatever specific example i give, as i feel strongly that this is a general and valid issue however one use case might be:
again this isnt a great example but i dont think original issue should be judged on a specific example |
Ok, let's keep this open for a while and try to get some other opinions. |
I was running into this, too. Building https://github.com/crawl/crawl, I was looking for possible locations of any generated "crawl" files/binaries: $ cd crawl/crawl-ref/source
$ ls -l | wc -l
1338 # lots of files/dirs in current directory!
# Let's try to find "crawl" files/dirs. Seems like there are only two of them...
$ fd -g crawl
android-project/src/org/develz/crawl
mac/crawl
# But the one I was looking for, the third one, was actually in the current directory
$ find . -name crawl
./android-project/src/org/develz/crawl
./mac/crawl
./crawl # <<< this one It really caught me by surprise that
Opposite experience here, fwiw. Frankly, I would have expected the default to include the cwd, and if anything have a separate option to exclude the cwd. From a user experience POV, excluding the cwd doesn't make sense to me. Yes,
Programming language examples where standard behavior when recursing a directory tree does include the cwd:
Personally, I don't know any tool where cwd would not be included. Well, now I know PS: I ended up here because I was googling for how to include the cwd when running |
@miguno I think you are seeing something else. Probably, |
@tmccombs: Doh, you are totally right. It was indeed a |
My use case is the following: Using find also returns the parent directory. If a file is removed, the parent directory modification date changes and make accounts for removed files. If I use fd: I get the nested folders individually but not the the parent (for the case a file is deleted in the "root" of PATH. Do you know a workaround in order to show the parent folder? |
I think the easiest workaround is something like filename.jar: PATH $(shell fd . PATH) i.e. just listing PATH explicitly as a prerequisite. (Personally I would just use |
As a user, I find weird that fd doesn't have an option for including the current directory. |
Hi. My use case is that I want to perform a global search using fzf. I would like to set its default command as follows: For searching across drives:
Additionally, I want to include the drive letters themselves in the search results.
In this case, I also want to include the source folders in the result list so that I can choose them as the paste destination, for example. Edit: Here’s an alternative approach that worked for me:
|
My use case (for including target in results) is this example to remove all empty directories recursively. Correct me if I'm wrong but there's no equivalent to this
With
I'm curious of a workaround that is relatively simple and doesn't involved calling P.S. Unrelated, but n my attempt above, I was also thinking that exit codes to reflect whether or not there are results would be be useful. |
My use case is opening directories immediately with nvim through fzf. Sometimes, I just want the parent dir instead of choosing any of the subdirs. Here is my workaround for it. nvim $({ echo $XDG_CONFIG_HOME & fd -L -d 1 -t d . $XDG_CONFIG_HOME } | fzf) |
The find tool includes the current directory:
and the ls tool has an option for it:
The text was updated successfully, but these errors were encountered: