Last active
January 7, 2017 12:58
-
-
Save ruizjme/ec8a77b2b9ede69ac79847be69859901 to your computer and use it in GitHub Desktop.
Populate usb drives in bulk for a conference giveaway.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import shutil | |
import time | |
# DIRECTORY PATHS ========================= | |
driveName = 'DISK_IMG' | |
drivePath = '../../Volumes/%s' % driveName | |
folderName = 'EAMSC-files' | |
folderPath = 'Desktop/%s' % folderName | |
files = os.listdir(folderPath) | |
# CHECK IF ISDIR ========================== | |
while True: | |
if os.path.isdir(drivePath): | |
# COPYING ACTION ================== | |
print '---' | |
for f in files: | |
shutil.copyfile('%s/%s' % (folderPath, f), | |
'%s/%s' % (drivePath, f)) | |
print 'Copied: %s' % f | |
print '---' | |
while os.path.isdir(drivePath): | |
print 'Unplug USB drive.' | |
time.sleep(5) | |
else: | |
print 'Connect USB drive to copy files.' | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment