Last active
July 11, 2020 18:22
-
-
Save jakekara/38b4d9fd2eee6af066010bcaa72349ec to your computer and use it in GitHub Desktop.
Find files with matching patterns using wolframscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env wolframscript | |
(* Recursively dump a list of files that match a given pattern *) | |
(* Very basic script to play with Wolfram outside of Notebooks *) | |
(* Jake Kara <jake@jakekara.com *) | |
(* Example usage: *) | |
(* ./glob.wl "*.txt" *) | |
If[ | |
Length[$ScriptCommandLine] < 2, | |
Print["Usage: " <> $ScriptCommandLine[[1]] <> " PATTERN"]; Exit[1] | |
] | |
pattern = $ScriptCommandLine[[2]] | |
PrintLine[str_] := Print[str] | |
Map[PrintLine,FileNames[pattern,"./", Infinity]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment