Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.055 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'wrapper': 0.07; 'attribute': 0.09; 'attributes,': 0.09; 'rename': 0.09; 'subject:files': 0.09; 'am,': 0.14; 'wrote:': 0.14; 'preserved': 0.16; 'renames': 0.16; 'semanchuk': 0.16; 'shutil': 0.16; 'case.': 0.16; 'command': 0.19; 'handles': 0.20; "didn't": 0.25; 'version': 0.25; "i'm": 0.26; 'thanks': 0.29; 'received:75': 0.30; 'does': 0.31; 'to:addr:python-list': 0.32; 'thank': 0.32; 'copying': 0.34; 'using': 0.34; 'there': 0.35; 'file': 0.35; 'received:rr.com': 0.35; 'received:mail.rr.com': 0.35; 'none': 0.36; 'shows': 0.36; 'system.': 0.37; 'exactly': 0.37; '20,': 0.38; 'apr': 0.38; 'files': 0.38; 'realize': 0.39; 'to:addr:python.org': 0.39; 'works': 0.40; "it's": 0.40; 'philip': 0.60; 'simple': 0.60; 'from:no real name:2**0': 0.60; 'taking': 0.61; 'extended': 0.64; 'share': 0.67; 'article': 0.75; '(snow': 0.84; '16:30': 0.84; 'jay': 0.84; 'metadata': 0.84; 'well:': 0.84 Authentication-Results: cdptpa-omtalb.mail.rr.com smtp.user=jyoung79@kc.rr.com; auth=pass (LOGIN) X-Authority-Analysis: v=1.1 cv=2vPzMgfOIErJN3e9oB0C+rg2PyH4jEtKOmutOqWodeY= c=1 sm=0 a=vYBo3EzpB60A:10 a=IkcTkHD0fZMA:10 a=-w5ALONIAAAA:8 a=ayC55rCoAAAA:8 a=LinV0nLEinDzxsnnAbwA:9 a=rP6CjnBQ4CdaP2qVpCAA:7 a=QEXdDO2ut3YA:10 a=tX5XewDJAJsA:10 a=rP986PgBVUNmvCLcgKrpog==:117 X-Cloudmark-Score: 0 Date: Wed, 20 Apr 2011 20:06:11 +0000 From: To: python-list@python.org Subject: RE: renaming files in OS X MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) Sensitivity: Normal X-Originating-IP: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303329973 news.xs4all.nl 81483 [::ffff:82.94.164.166]:55683 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3747 > In article <280CB56A-89B8-4D62-9374-D769B3ACFEBB at semanchuk.com>, > Philip Semanchuk wrote: > > On Apr 20, 2011, at 10:02 AM, =20 > > wrote: > > > I'm considering using os.rename or shutil for renaming=20 > > > files on OS X (Snow Leopard)=E2=80=A6 > os.rename() is a simple wrapper around the standard rename system call=20 > (man 2 rename) so it has the same semantics. Extended attributes,=20 > including resource forks, are preserved by rename(2). Note that the=20 > system call only works for renames within one file system. The mv(1)=20 > program handles cross-system renames by copying and unlinking and the=20 > Apple-supplied version does copy extended attribute metadata in that=20 > case. As documented, none of the shutil copy functions do that. > > The OS X command xattr shows whether or not a file has extended attrib= utes,=20 > The 'ls -l' command does as well: > $ ls -l a.jpg > -rw-r--r--@ 1 nad staff 2425268 Apr 4 16:30 a.jpg > $ ls -l@ a.jpg > -rw-r--r--@ 1 nad staff 2425268 Apr 4 16:30 a.jpg > com.apple.FinderInfo 32 Hi Ned, Thanks so much for this detail! I didn't even realize there was a standard rename system call - it's always nice learning something new about this system. Again, thank you for taking the time to share your knowledge. This is exactly what I was looking for! Jay