-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|