Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'filename': 0.07; 'filenames': 0.07; 'expectation': 0.09; 'inserted': 0.09; 'iterate': 0.09; 'lawrence': 0.09; 'to:addr:comp.lang.python': 0.09; 'tuple': 0.09; 'cc:addr:python-list': 0.10; 'stored': 0.10; 'files.': 0.13; 'ignore': 0.13; 'dirnames,': 0.16; 'dirpath,': 0.16; 'idle.': 0.16; 'losing': 0.16; 'michael,': 0.16; 'os.walk': 0.16; 'sec': 0.16; 'subject: \n ': 0.16; 'subject:based': 0.16; 'subject:values': 0.16; 'troll': 0.16; 'tuple,': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'changes': 0.20; 'skip:" 30': 0.20; 'trying': 0.21; 'cc:2**0': 0.23; 'insert': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '+0100,': 0.29; 'questions.': 0.29; 'thinks': 0.29; "skip:' 10": 0.30; 'that.': 0.30; 'folder': 0.30; 'waste': 0.30; 'subject:data': 0.33; 'guys': 0.33; 'received:google.com': 0.34; 'self': 0.34; 'path': 0.35; 'so,': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'michael': 0.36; 'but': 0.36; 'thank': 0.36; 'display': 0.36; 'supporting': 0.37; 'why': 0.37; 'item': 0.37; 'previous': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'files': 0.38; 'fact': 0.38; 'some': 0.38; 'instead': 0.39; 'notice': 0.39; 'think': 0.40; 'from:no real name:2**0': 0.60; 'containing': 0.61; 'world': 0.63; 'skip:= 30': 0.64; 'here': 0.65; 'our': 0.65; 'records': 0.68; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'refusing': 0.84; 'suits': 0.84 X-Received: by 10.49.12.130 with SMTP id y2mr2961175qeb.31.1362586163532; Wed, 06 Mar 2013 08:09:23 -0800 (PST) Newsgroups: comp.lang.python Date: Wed, 6 Mar 2013 08:09:23 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.127.128; posting-account=hGu1uQoAAACZy7LiR653nG0NwqDrTyoS References: <390f0dc5-5750-4849-9433-a19d90cc8566@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.68.127.128 MIME-Version: 1.0 Subject: Re: sync databse table based on current directory data without losign previous values From: nagia.retsina@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 102 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362592425 news.xs4all.nl 6877 [2001:888:2000:d::a6]:37664 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40653 =CE=A4=CE=B7 =CE=A4=CE=B5=CF=84=CE=AC=CF=81=CF=84=CE=B7, 6 =CE=9C=CE=B1=CF= =81=CF=84=CE=AF=CE=BF=CF=85 2013 4:04:26 =CE=BC.=CE=BC. UTC+2, =CE=BF =CF= =87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Michael Ross =CE=AD=CE=B3=CF=81=CE= =B1=CF=88=CE=B5: > On Wed, 06 Mar 2013 12:52:00 +0100, Mark Lawrence =20 >=20 > wrote: >=20 >=20 >=20 > > On 06/03/2013 07:45, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE=93=CE=BA=CF=813= 3=CE=BA wrote: >=20 > >> I'am using this snipper to read a current directory and insert all =20 >=20 > >> filenames into a databse and then display them. >=20 > >> >=20 > >> But what happens when files are get removed form the directory? >=20 > >> The inserted records into databse remain. >=20 > >> How can i update the databse to only contain the existing filenames = =20 >=20 > >> without losing the previous stored data? >=20 > >> >=20 > >> Here is what i ahve so far: >=20 > >> >=20 > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > >> path =3D "/home/nikos/public_html/data/files/" >=20 > >> >=20 > >> #read the containing folder and insert new filenames >=20 > >> for result in os.walk(path): >=20 > > >=20 > > You were told yesterday at least twice that os.walk returns a tuple but= =20 >=20 > > you still insist on refusing to take any notice of our replies when it = =20 >=20 > > suits you, preferring instead to waste everbody's time with these =20 >=20 > > questions. Or are you trying to get into the Guinness Book of World = =20 >=20 > > Records for the laziest bastard on the planet? >=20 >=20 >=20 > Hold on a sec ... >=20 >=20 >=20 > He has >=20 >=20 >=20 > for result in os.walk(path): >=20 > for filename in result[2]: >=20 >=20 >=20 > So he *did* take notice of that. >=20 >=20 >=20 >=20 >=20 > Nikos: >=20 > Expectation is to iterate through a tuple like this: >=20 >=20 >=20 > for dirpath, dirnames, filenames in os.walk(path): >=20 > ... Thank you Michael, yes i ahve understood that myself yesterday after one of= the guys here have shown the output of os.walk(path) in IDLE.=20 So, yes in fact i was in need for the 3rd item in the tuple, so to get hold= on to the files. Thank you for supporting me, some ppl here think i'am a troll and don't try= thinks or ignore evrything but 'some_ppl's_opinion !=3D True' I'am just sometimes persistant on having thing my way that why i was callin= g my self Ferrous cRanus, which i changes it since it was annoying....