Hi Anthony

Here is some stuff to get you started (this is from memory, I'm not checking it, but should be mostly helpful):

***
import os

os.chdir('C:\My Documents') # Can use this to jump around to different folders
fileNames = os.listdir('.') # Checks the now current folder
namesToMatch = ['readme.txt','readme.doc'] # Buncha names to find


for item in fileNames:  # check every filename
  if item in namesToMatch:  # is this item in the required list?
    print 'Match found: '+item  # if you found one, say so.
***

Hope this helps.
Caleb




On Sun, 06 Feb 2005 18:29:34 +0000, anthonyberet <[EMAIL PROTECTED]> wrote:

Hi, I am new at Python, and very rusty at the one language I was good at, which was BASIC.

I want to write a script to compare filenames in chosen directories, on windows machines. Ideally it would compose a list of strings of all the filenames in the directories, and those directories would be chosable by the user of the script.

I am quite happy to do my own legwork on this , I realise it is simple stuff, but can anyone point me in the right direction to start?

Thanks

-- http://mail.python.org/mailman/listinfo/python-list

Reply via email to