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

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

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

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...' )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.