Skip to content

Instantly share code, notes, and snippets.

@aausch
Last active December 23, 2015 00:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aausch/6557158 to your computer and use it in GitHub Desktop.
Python script for running touch on a list of directories, and their contents
#!/usr/bin/python
#
# run with: python recursive_touch.py <directory_name>
# touches all contents of <directory_name>, and recurses into subdirectories.
# WARNING! don't run unless you actually intend to do all that touching.
# some things, should not be touched.
#
# Copyright 2013, Alex Ausch
# Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/
#
## https://gist.github.com/aausch/6557158
import os, sys, subprocess
for d,s,fs in os.walk(sys.argv[1]):
for p in (s+fs):
subprocess.call(["touch",os.path.join(d,p)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment