Skip to content

Instantly share code, notes, and snippets.

@lozhn
Last active August 29, 2015 14:10
Show Gist options
  • Save lozhn/8e03a09493e0ff8f3621 to your computer and use it in GitHub Desktop.
Save lozhn/8e03a09493e0ff8f3621 to your computer and use it in GitHub Desktop.
Solves unix limit dir limit. 2012. ITSumma
#!usr/bin/python
import os, os.path, shutil
os.chdir("data")
list_of_dir = [name for name in os.listdir('.') if os.path.isfile(name) or os.path.isdir(name)]
for var in list_of_dir:
if not os.path.exists(var[0:2].upper()) :
os.mkdir(var[0:2].upper())
shutil.move(var, var[0:2].upper())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment