Skip to content

Instantly share code, notes, and snippets.

@BTruer
BTruer / RenameFiles.py
Created August 19, 2016 15:38
This is a script that will rename files if they look a certain way. This is a template so it will need to be customized based on your needs.
import os, sys
allTheFiles = os.listdir(os.getcwd()) #This is a list of all the files in your directory
for filename in allTheFiles: #Each filename is grabed from the list as a string
if("Certain String is in the filename" in filename): #This is an additional check to see if there are only certain files you want to change. Else this check is not needed if you want to change all the files.
os.rename(filename ,"New file name" + filename[33:]) #os.rename(<oldFileName>,<newFileName>); The filename[10:] is if you may want to keep certain parts of the old file name. For help look up python string methods.
print "Rename Complete"
Have docker installed on your machine.
Copy this file:
docker-compose.yml
# Use postgres/example user/password credentials
version: '3.1'
#https://hub.docker.com/_/postgres/
services:
db: