Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- from shutil import copy
- def main():
- if len(sys.argv) > 1:
- if not os.path.exists('CppPresentations'): # checks whethear the directory exists and creates it if required
- os.makedirs('CppPresentations')
- path = sys.argv[1]
- dirs = [path + '/' + dir for dir in os.listdir(path) if os.path.isdir(path + '/' + dir)] # finds all the sub directories of the given path
- presentations = [dir + '/' + file for dir in dirs for file in os.listdir(dir) if file.endswith('.pptx')] # gets all the presentations pathes
- for file in presentations:
- copy(file, 'CppPresentations') # copies it
- else:
- print 'usage: <path>'
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement