Skip to content

Instantly share code, notes, and snippets.

@Nzen
Last active August 29, 2015 14:04
Show Gist options
  • Save Nzen/48f864bae7e1eb162ed6 to your computer and use it in GitHub Desktop.
Save Nzen/48f864bae7e1eb162ed6 to your computer and use it in GitHub Desktop.
CLI script prints the absolute path folder hierarchy and alternates with /* to catch the files.
import os
def main() :
command = "sdelete.exe "# or "echo " for testing
folder_flag = "-r "
here = os.getcwd()
the_files = "\\*"
current = ""
for_bash = ""
for directory_tuple in os.walk( here, False ) : # top dir, start from top?
current = directory_tuple[0] # absolute path
if current == here :
return # else, I'll delete this script
# surround folder name to preserve spaces
for_bash = command + '\"' + current + the_files + '\"'
os.system( for_bash )
for_bash = command + '\"' + current + '\"'
os.system( for_bash )
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment