Skip to content

Commit

Permalink
Copying files
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin42 committed Apr 22, 2016
1 parent bc11c8b commit cf626b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions project13.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Selective copy

'''Walking through a folder tree and searching for files with a certain file extension('.jpg','.pdf')
and copying from whatever location they are present at to a new folder'''

import shutil

import os

# Walking through a folder tree
for folders,subfoldes,filenames in os.walk('/home/nitin'):
for filename in filenames:
if filename.endswith('.jpg') or filename.endswith('.pdf'):
shutil.copy(file_name,'/home/nitin/NEW_FOLDER')

0 comments on commit cf626b0

Please sign in to comment.