sync databse table based on current directory data without losign previous values

Dave Angel davea at davea.name
Wed Mar 6 08:31:40 EST 2013


On 03/06/2013 05:27 AM, Lele Gaifax wrote:
> Νίκος Γκρ33κ <nikos.gr33k at gmail.com> writes:
>
>> Its about the following line of code:
>>
>> current_fullpaths.add( os.path.join(root, files) )
>
> I'm sorry, typo on my part.
>
> That should have been "fullpath", not "file" (and neither "files" as you
> wrongly reported back!):
>
>    # Compute a set of current fullpaths
>    current_fullpaths = set()
>    for root, dirs, files in os.walk(path):
>      for fullpath in files:

'fullpath' is a rather misleading name to use, since the 'files' list 
contains only the terminal node of the file name.  It's only a full path 
after you do the following join.

>        current_fullpaths.add(os.path.join(root, fullpath))
>


-- 
DaveA



More information about the Python-list mailing list