Skip to content

Instantly share code, notes, and snippets.

@breinbaas
Last active June 20, 2023 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breinbaas/96799a68206161d8e2aff22a5917fc80 to your computer and use it in GitHub Desktop.
Save breinbaas/96799a68206161d8e2aff22a5917fc80 to your computer and use it in GitHub Desktop.
from pathlib import Path
import subprocess
PATH_TO_DSTABILITY_CONSOLES = "D:\\Apps\\D-GEO Suite\\Consoles\\DStabilityConsole"
def case_insensitive_glob(filepath: str, fileextension: str) -> List[Path]:
p = Path(filepath)
result = []
for filename in p.glob("**/*"):
if str(filename.suffix).lower() == fileextension.lower():
result.append(filename.absolute())
return result
def convert(path: str):
exe = Path(PATH_TO_DSTABILITY_CONSOLES) / "D-Stability Migration Console.exe"
stix_files = case_insensitive_glob(path, ".stix")
for stix_file in stix_files:
new_file = Path(stix_file.parent.absolute() / f"{stix_file.stem}_new.stix")
subprocess.run([exe, stix_file, new_file])
# test
if __name__ == "__main__":
convert("testdata/old_stix")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment