Skip to content

Can't move files after opening them #349

Description

@firas5673

I can't move game files after loading them with UnityPy.
I call a function that has env = UnityPy.load(file_path) inside it, then after that when I try to move the file to another location, I can't do that.

Here's a simplified version of the code:

The function:

def is_excluded_file(file_path):
    try:
        env = UnityPy.load(file_path)
    except:
        return False
    for path,obj in env.container.items():
        if condition(path):
            return True
    return False

for file_path in file_walker(assetbundle_path): #recursively yields every file's path in the folder
    if is_excluded_file(file_path):
        dir_path  = os.path.dirname(file_path)
        nested_path_lib = Path(os.path.join(move_folder, dir_path))
        nested_path_lib.mkdir(parents=True, exist_ok=True)
        shutil.move(file_path, os.path.join(move_folder, file_path))

I get an error at that last line, saying that it's being used by another process (which is UnityPy).
Is there a way to "close" this process?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions