Skip to content

Instantly share code, notes, and snippets.

@arto-heino
Created May 22, 2019 06: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 arto-heino/7101084c39433ff5289f3bdea9c97a55 to your computer and use it in GitHub Desktop.
Save arto-heino/7101084c39433ff5289f3bdea9c97a55 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import os
# First get the folder name (SSN) and save it
folderlist = [name for name in os.listdir(".") if os.path.isdir(name)]
# Second get filelist on folder
def new_list(x):
for ssn in x:
for filename in os.listdir(ssn):
new_name = str(ssn) + '_' + str(filename)
# Third rename files to SSN_filenames
os.rename(os.listdir(i), new_name)
new_list(folderlist)
# Fourth move all files to raportit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment