Searching for Files through a Directory -- PLEASE HELP!!!

Reply

Join Date: Apr 2006
Posts: 2
Reputation: pare80 is an unknown quantity at this point 
Solved Threads: 0
pare80 pare80 is offline Offline
Newbie Poster

Searching for Files through a Directory -- PLEASE HELP!!!

 
0
  #1
Apr 21st, 2006
Hello to all,

I am trying to create a script that will go through certain directorys in Windows and pull out the files I stated by extentions. Which will then later copy to a location either on the local machine or an external HD.

Any assistence will be greatly appricated.
Thanx in advance,

ParE
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Searching for Files through a Directory -- PLEASE HELP!!!

 
0
  #2
Apr 21st, 2006
Originally Posted by pare80
Hello to all,

I am trying to create a script that will go through certain directorys in Windows and pull out the files I stated by extentions. Which will then later copy to a location either on the local machine or an external HD.

Any assistence will be greatly appricated.
Thanx in advance,

ParE
what have you tried so far?

anyway, you can look up the manuals of some of these tools
- os.walk
- glob
- shutil
- os.path.splitext

to achieve what you need
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 2
Reputation: pare80 is an unknown quantity at this point 
Solved Threads: 0
pare80 pare80 is offline Offline
Newbie Poster

Re: Searching for Files through a Directory -- PLEASE HELP!!!

 
0
  #3
Apr 21st, 2006
Originally Posted by ghostdog74
what have you tried so far?

anyway, you can look up the manuals of some of these tools
- os.walk
- glob
- shutil
- os.path.splitext

to achieve what you need

I have tried the above

For example

The path and file's could be simliar

Ex: C:\Lotus\Notes\Data\mail*\*

mail could be any number from mail 1 - 100 and whatever files that follow.

Ex: C:\Lotus\Notes\Data\mail10\myname.nsf

I just need to be able to back up myname.nsf -- Please help - would like to get this project done in Python.

ParE
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 18
Reputation: sharma_vivek82 is an unknown quantity at this point 
Solved Threads: 0
sharma_vivek82 sharma_vivek82 is offline Offline
Newbie Poster

Re: Searching for Files through a Directory -- PLEASE HELP!!!

 
0
  #4
Apr 21st, 2006
i think this will help you out, this is not the exact solution of your problem, but now you can find yourself.please indent it yourself, i am unable to indent in message box.
code:
import os
def directoryWalker( unused, dirName, nameList ):
print "Entering new directory: " + dirName
filename = raw_input("Enter file name : ")
if filename in nameList:
print "file is present"
print " " + os.path.join( dirName, filename )
print " "
else:
print "file is not here"

if __name__ == '__main__':
os.path.walk( os.curdir, directoryWalker, None )
raw_input( '\n\nPress Enter to exit...' )
Last edited by sharma_vivek82; Apr 21st, 2006 at 1:33 am. Reason: why indentation is not working
Best wishes,
Vivek Sharma
Zope/Python Developer
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC