Skip to content

Instantly share code, notes, and snippets.

@jeffThompson
Created June 2, 2015 00:53
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 jeffThompson/531f20f8243023a10821 to your computer and use it in GitHub Desktop.
Save jeffThompson/531f20f8243023a10821 to your computer and use it in GitHub Desktop.
Copy all hidden files. Because art.
import os, fnmatch, shutil
'''
COPY ALL HIDDEN FILES
Jeff Thompson | 2015 | www.jeffreythompson.org
Why? Art.
'''
# where to look, where to put em
search_path = '/Users/JeffThompson/'
copy_path = '/Users/JeffThompson/Desktop/HIDDEN/'
# get em
print 'Searching for files (may take a while)...'
hidden_files = [ os.path.join(dirpath, f)
for dirpath, dirnames, files in os.walk(search_path)
for f in fnmatch.filter(files, '.*') ]
print '- found ' + str(len(hidden_files)) + ' matching files!'
# copy em
print '\n' + 'Copying files...'
for i, f in enumerate(hidden_files):
try:
shutil.copy2( f, copy_path + format(i, '08') )
except:
pass
# done
print '\n' + 'DONE!' + '\n\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment