-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add -printf formatting like GNU find #533
Comments
That's what fd --changed-within=10days -X ls -dl --time-style=long-iso
The equivalent command would use
How do you perform your benchmarks? Do you account for disk caching effects? |
My result set for that is too large (~20000) files. I'm getting: I actually tried to pipe to
Yes my mistake :)
Hyperfine is cool. I was using Actually, my example was a simplified version of what I actually use, which is listing the whole file system. ( for instant searching like Here's my hyperfine result (gfind and gls are GNU versions of the commands)
Sorry for the superfluous arguments (-E|-prune), I was copying the command from another search. I actually tried to run this command on the whole file system (~2 million files) but after 55 minutes, I gave up. |
Unfortunately, this is a known issue which should be fixed, see #410.
Are you sure that this is caused by the parallel execution? Or could it be related to file names with spaces? In the latter case, please try to use the
This seems to work just fine for me (even with smaller |
Yes, this is a known issue. Here. Here also. I am using -0 on fd and xargs
-n isn't the issue, it's the combination with -P that causes the output to get garbled. I'm guessing it has something to do with the write buffer, I haven't completely understood it . This is not related to fd, I get the same effect when cating the file list into xargs -P0. Anyway when using fd with xargs -n1500 , find is still getting better results:
When I run xargs with -P , fd/xargs is about half the time of find but about 1000 files out of 2million are garbled so I cannot use it.
I would think that adding -printf like option would overcome all this piping because my guess is that fd is already stating everyfile and piping out to another command would never be as fast as internal function (for data it already has). |
I would also find A use-case: Sometimes we need to sanitize filenames to port them from one platform to another. We find extreme cases, such as (not kidding),
|
To my knowledge, there is currently no (convenient) way to print the list of files sorted by modification date as shown here https://stackoverflow.com/a/1405664: APPENDUM:
|
Throwing another vote into the ring for |
I have made a PR that might help with some uses of this: #1043 but I haven't gotten around to benchmarking it yet. |
Unfortunately I don't know Rust so can't understand any of your changes. A little example of the core functionality you're adding would make a nice addition to the PR description. That way people like me can follow. Regardless, if your changes bring about some |
Windows 7 x64, fd 9.0.0. I want to get a list of folders with Bypassing fd's birth traumas of having to specify the Workaround using coreutils or busybox: $ fd -H -g ".startup" -X coreutils dirname {} | coreutils sort
.\01 Portable\Autohotkey
.\01 Portable\DNSCrypt
.\01 Portable\Keepass |
Hi
Please add a -printf like feature to fd.
Currently, to get the file information I'm running:
fd --changed-within=10days -x ls -dl --time-style=long-iso "{}"
Which spawns
ls
for every result.This is actually much slower than running:
find . -mtime 10 -printf "%TY-%Tm-%Td %TH:%TM %p\n"
(For example)
Test dataset is around 20,000 files. fd is running for ~21 seconds, find for ~10.
Of course when more results are found, fd method would become slower.
Thanks !
The text was updated successfully, but these errors were encountered: