Re: Arrange files according to a text file

2011-08-27 Thread Ric
No, it turned out to be my mistake. Your code was correct and I appreciate it very much. Thank you again On Sat, 27 Aug 2011 18:10:07 -0700, Emile van Sebille wrote: >On 8/27/2011 4:18 PM r...@rdo.python.org said... >> Thank you so much. The code worked perfectly. >> >> This is what I tried us

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 4:18 PM r...@rdo.python.org said... Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too mu

Re: Arrange files according to a text file

2011-08-27 Thread Ric
On Sun, 28 Aug 2011 00:48:20 +0100, MRAB wrote: >On 28/08/2011 00:18, r...@rdo.python.org wrote: >> Thank you so much. The code worked perfectly. >> >> This is what I tried using Emile code. The only time when it picked >> wrong name from the list was when the file was named like this. >> >> Data

Re: Arrange files according to a text file

2011-08-27 Thread MRAB
On 28/08/2011 00:18, r...@rdo.python.org wrote: Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too muc

Re: Arrange files according to a text file

2011-08-27 Thread Stephen Hansen
On 8/27/11 11:06 AM, Emile van Sebille wrote: > from difflib import SequenceMatcher as SM > > def ignore(x): > return x in ' ,.' > > for filename in filenames: > ratios = [SM(ignore,filename,username).ratio() for username in > usernames] > best = max(ratios) > owner = usernames[ra

Re: Arrange files according to a text file

2011-08-27 Thread Ric
Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too much? import os from difflib import SequenceMatche

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 1:15 PM r...@rdo.python.org said... Hello Emile , Thank you for the code below as I have not encountered SequenceMatcher before and would have to take a look at it closer. My question would it work for a text file list of names about 25k lines and a directory with say 100 files in

Re: Arrange files according to a text file

2011-08-27 Thread Ric
Hello Emile , Thank you for the code below as I have not encountered SequenceMatcher before and would have to take a look at it closer. My question would it work for a text file list of names about 25k lines and a directory with say 100 files inside? Thank you once again. On Sat, 27 Aug 2011

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 10:03 AM r...@rdo.python.org said... Hello, What would be the best way to accomplish this task? I'd do something like: usernames = """Adler, Jack Smith, John Smith, Sally Stone, Mark""".split('\n') filenames = """Smith, John - 02-15-75 - business files.doc Random Data - Adler J

Re: Arrange files according to a text file

2011-08-27 Thread MRAB
On 27/08/2011 18:03, r...@rdo.python.org wrote: Hello, What would be the best way to accomplish this task? I have many files in separate directories, each file name contain a persons name but never in the same spot. I need to find that name which is listed in a large text file in the following f

Arrange files according to a text file

2011-08-27 Thread Ric
Hello, What would be the best way to accomplish this task? I have many files in separate directories, each file name contain a persons name but never in the same spot. I need to find that name which is listed in a large text file in the following format. Last name, comma and First name. The last n