Skip to content

Instantly share code, notes, and snippets.

@013231
Created July 8, 2012 13:14
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 013231/3070895 to your computer and use it in GitHub Desktop.
Save 013231/3070895 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import os
import shutil
count = 0
for filename in os.listdir('.'):
if filename.endswith('.txt') and os.path.isfile(filename):
destDir = 'AAA%d' % (count / 500 + 1)
if count % 500 == 0:
os.mkdir(destDir)
shutil.move(filename, destDir)
count += 1
if count % 1000 == 0:
print '%d files have been moved.' % count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment