Skip to content

Instantly share code, notes, and snippets.

@BedirYilmaz
Created December 14, 2017 00:34
Show Gist options
  • Save BedirYilmaz/cb0bb20bcb1b592a4738edebb624b066 to your computer and use it in GitHub Desktop.
Save BedirYilmaz/cb0bb20bcb1b592a4738edebb624b066 to your computer and use it in GitHub Desktop.
Py script that renames a file to names of its parent folders : to be used with find_rename_and_copy.sh
#!/usr/bin/env python3
import shutil
import sys
import string
pathStr = sys.argv[1]
splittedPath = string.split(pathStr, '/')
upper = splittedPath[-3]
upper_2 = splittedPath[-5]
shutil.copy(pathStr, upper_2 + upper + 'output.mp4')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment