Re: [Factor-talk] Search Files by Name
You can do things like: USE: io.directories.search "/Users/erg/factor" [ file-name >lower "factor" head? ] find-all-files On Sat, Oct 29, 2016 at 9:55 AM John Benediktssonwrote: > I hit send before I had a chance to finish that thought -- > > You can use ``file-info directory?`` to exclude directories or ``file-info > regular-file?`` to include only regular files. > > There are other file types that might be returned in the ``file-info`` > tuple: > > http://docs.factorcode.org/content/article-file-types.html > > > > > On Sat, Oct 29, 2016 at 9:51 AM, John Benediktsson > wrote: > > Directories are files too! :-) > > > On Oct 29, 2016, at 9:24 AM, Alexander Ilin wrote: > > > > Hello! > > > > Thank you, Björn and John, for the great suggestions! > > I didn't know about the `globs` vocab, and it's almost undocumented. A > couple of examples wouldn't hurt. > > > > Unfortunately, `find-all-files` returns directories as well. Is that a > bug? > > > > ---=--- > > Александр > > > > > -- > > The Command Line: Reinvented for Modern Developers > > Did the resurgence of CLI tooling catch you by surprise? > > Reconnect with the command line and become more productive. > > Learn the new .NET and ASP.NET CLI. Get your free copy! > > http://sdm.link/telerik > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
I hit send before I had a chance to finish that thought -- You can use ``file-info directory?`` to exclude directories or ``file-info regular-file?`` to include only regular files. There are other file types that might be returned in the ``file-info`` tuple: http://docs.factorcode.org/content/article-file-types.html On Sat, Oct 29, 2016 at 9:51 AM, John Benediktssonwrote: > Directories are files too! :-) > > > On Oct 29, 2016, at 9:24 AM, Alexander Ilin wrote: > > > > Hello! > > > > Thank you, Björn and John, for the great suggestions! > > I didn't know about the `globs` vocab, and it's almost undocumented. A > couple of examples wouldn't hurt. > > > > Unfortunately, `find-all-files` returns directories as well. Is that a > bug? > > > > ---=--- > > Александр > > > > > -- > > The Command Line: Reinvented for Modern Developers > > Did the resurgence of CLI tooling catch you by surprise? > > Reconnect with the command line and become more productive. > > Learn the new .NET and ASP.NET CLI. Get your free copy! > > http://sdm.link/telerik > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
Directories are files too! :-) > On Oct 29, 2016, at 9:24 AM, Alexander Ilinwrote: > > Hello! > > Thank you, Björn and John, for the great suggestions! > I didn't know about the `globs` vocab, and it's almost undocumented. A couple > of examples wouldn't hurt. > > Unfortunately, `find-all-files` returns directories as well. Is that a bug? > > ---=--- > Александр > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
Hello! Thank you, Björn and John, for the great suggestions!I didn't know about the `globs` vocab, and it's almost undocumented. A couple of examples wouldn't hurt. Unfortunately, `find-all-files` returns directories as well. Is that a bug? ---=---Александр -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
Also, I should point out that ``glob`` doesn't require ``with-directory``: "C:\dir\**\progname" glob On Sat, Oct 29, 2016 at 8:39 AM, John Benediktssonwrote: > You can use recursive globs (which are case-insensitive) as @bjourne says, > or you can use ``find-all-files`` in io.directories.search. The name is the > fully qualified name, so if you want to match only on the file-name you can > do: > > USE: io.directories.search > > "C:\dir" [ file-name R/ progname/i matches? ] find-all-files > > "C:\dir" [ file-name >lower "progname" = ] find-all-files > > Or you can use the FindFile/FindNextFile directly by looking at the code > in io.directories.windows. > > Best, > John. > > > On Sat, Oct 29, 2016 at 8:30 AM, Björn Lindqvist > wrote: > >> Perhaps you can use ant-globs. Like this: >> >> USE: globs >> "/the/dir" [ "**/progname*" glob ] with-directory >> >> It appears to fold case by default so it should match any PROGNAME >> files too. It also matches directories which you might want to filter >> out. >> >> 2016-10-29 16:41 GMT+02:00 Alexander Ilin : >> > Hello! >> > >> > What's the best way to search for all files matching a pattern >> "progname.*"? >> > Note: in Windows the "name" part is case-insensitive. >> > >> > I see that we have `find-by-extension` in `io.directories.search`, but >> > nothing to search by name. >> > >> > I want to find and scan all log-files in a folder, created by a program >> that >> > uses "progname." scheme for naming its files, and the casing in the >> > "progname" part is not always the same. >> > >> > If I were using FindFirstFile/FindNextFile WinAPI, I would have just >> > supplied the "progname.*" mask, but I see no way to supply the mask via >> the >> > high-level calls, and I don't want to allocate the platform-specific >> > ``s in my code. >> > >> > What would be the best way to search for the thing I need? Do we have a >> > case-insensitive regexp matcher? >> > >> > ---=--- >> > Александр >> > >> > >> > >> -- >> > The Command Line: Reinvented for Modern Developers >> > Did the resurgence of CLI tooling catch you by surprise? >> > Reconnect with the command line and become more productive. >> > Learn the new .NET and ASP.NET CLI. Get your free copy! >> > http://sdm.link/telerik >> > ___ >> > Factor-talk mailing list >> > Factor-talk@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/factor-talk >> > >> >> >> >> -- >> mvh/best regards Björn Lindqvist >> >> >> -- >> The Command Line: Reinvented for Modern Developers >> Did the resurgence of CLI tooling catch you by surprise? >> Reconnect with the command line and become more productive. >> Learn the new .NET and ASP.NET CLI. Get your free copy! >> http://sdm.link/telerik >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
You can use recursive globs (which are case-insensitive) as @bjourne says, or you can use ``find-all-files`` in io.directories.search. The name is the fully qualified name, so if you want to match only on the file-name you can do: USE: io.directories.search "C:\dir" [ file-name R/ progname/i matches? ] find-all-files "C:\dir" [ file-name >lower "progname" = ] find-all-files Or you can use the FindFile/FindNextFile directly by looking at the code in io.directories.windows. Best, John. On Sat, Oct 29, 2016 at 8:30 AM, Björn Lindqvistwrote: > Perhaps you can use ant-globs. Like this: > > USE: globs > "/the/dir" [ "**/progname*" glob ] with-directory > > It appears to fold case by default so it should match any PROGNAME > files too. It also matches directories which you might want to filter > out. > > 2016-10-29 16:41 GMT+02:00 Alexander Ilin : > > Hello! > > > > What's the best way to search for all files matching a pattern > "progname.*"? > > Note: in Windows the "name" part is case-insensitive. > > > > I see that we have `find-by-extension` in `io.directories.search`, but > > nothing to search by name. > > > > I want to find and scan all log-files in a folder, created by a program > that > > uses "progname." scheme for naming its files, and the casing in the > > "progname" part is not always the same. > > > > If I were using FindFirstFile/FindNextFile WinAPI, I would have just > > supplied the "progname.*" mask, but I see no way to supply the mask via > the > > high-level calls, and I don't want to allocate the platform-specific > > ``s in my code. > > > > What would be the best way to search for the thing I need? Do we have a > > case-insensitive regexp matcher? > > > > ---=--- > > Александр > > > > > > > -- > > The Command Line: Reinvented for Modern Developers > > Did the resurgence of CLI tooling catch you by surprise? > > Reconnect with the command line and become more productive. > > Learn the new .NET and ASP.NET CLI. Get your free copy! > > http://sdm.link/telerik > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > > > -- > mvh/best regards Björn Lindqvist > > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Search Files by Name
Perhaps you can use ant-globs. Like this: USE: globs "/the/dir" [ "**/progname*" glob ] with-directory It appears to fold case by default so it should match any PROGNAME files too. It also matches directories which you might want to filter out. 2016-10-29 16:41 GMT+02:00 Alexander Ilin: > Hello! > > What's the best way to search for all files matching a pattern "progname.*"? > Note: in Windows the "name" part is case-insensitive. > > I see that we have `find-by-extension` in `io.directories.search`, but > nothing to search by name. > > I want to find and scan all log-files in a folder, created by a program that > uses "progname." scheme for naming its files, and the casing in the > "progname" part is not always the same. > > If I were using FindFirstFile/FindNextFile WinAPI, I would have just > supplied the "progname.*" mask, but I see no way to supply the mask via the > high-level calls, and I don't want to allocate the platform-specific > ``s in my code. > > What would be the best way to search for the thing I need? Do we have a > case-insensitive regexp matcher? > > ---=--- > Александр > > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- mvh/best regards Björn Lindqvist -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Search Files by Name
Hello! What's the best way to search for all files matching a pattern "progname.*"?Note: in Windows the "name" part is case-insensitive. I see that we have `find-by-extension` in `io.directories.search`, but nothing to search by name. I want to find and scan all log-files in a folder, created by a program that uses "progname." scheme for naming its files, and the casing in the "progname" part is not always the same. If I were using FindFirstFile/FindNextFile WinAPI, I would have just supplied the "progname.*" mask, but I see no way to supply the mask via the high-level calls, and I don't want to allocate the platform-specific ``s in my code. What would be the best way to search for the thing I need? Do we have a case-insensitive regexp matcher? ---=---Александр -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk