Skip to content

Instantly share code, notes, and snippets.

@SeijiEmery
Created February 8, 2020 14:09
Show Gist options
  • Save SeijiEmery/015d70c4f5a3ff3a760c931f13ffecb1 to your computer and use it in GitHub Desktop.
Save SeijiEmery/015d70c4f5a3ff3a760c931f13ffecb1 to your computer and use it in GitHub Desktop.
Utility script: prints out non-file-associated meta files in a given unity directory, with the git command to remove them
import os
import sys
if __name__ == '__main__':
if len(sys.argv) > 1:
os.chdir(sys.argv[1])
target_dir = './Assets'
dir_meta_files = set([
os.path.join(path, file)
for path, dirs, files in os.walk(target_dir)
for file in files
if file.endswith('.meta') and len(file.split('.')) == 2
])
print("git rm %s" % ' '.join([
'"%s"' % file for file in dir_meta_files
]))
@SeijiEmery
Copy link
Author

SeijiEmery commented Feb 8, 2020

useful if you forgot to add this: https://answers.unity.com/questions/547795/ignoring-folder-meta-files-on-version-control.html, and have a bunch of directory-associated meta files that you want to remove

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