0

Okay, my program needs to find a file named system.sav but the files for it are always random.

It usually goes: Local>gamename>saved>saved games>(this is an random assortment of numbers or letters)>system.sav

The program im working on takes premade system.sav's and replaces them with the one that's already in the folder(and backed up). But theres one thing, since every user has a different folder is there anyway to get the name of the folder automatically, or do i need the user to input it? I really don't want to trust the user to do this, but I am not familiar enough with python to guarantee that they won't have to.

  • 1
    Something like [glob](https://docs.python.org/3/library/glob.html) might be what you're looking for. – Hampus Larsson May 29 '20 at 13:20
  • 2
    Not sure if I understand your question correctly. But I think you could use `glob` for what you're trying to achieve. There you can use wildcards like this: `glob.glob('Local/gamename/saved/saved games/*/system.sav')`. This will return a list of all files found. – trotta May 29 '20 at 13:20
  • 1
    Does this answer your question? [Find a file in python](https://stackoverflow.com/questions/1724693/find-a-file-in-python) – wwii May 29 '20 at 13:28

0 Answers0