Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!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.054 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'though.': 0.07; 'attributes,': 0.09; 'subject:files': 0.09; 'to:name:python list': 0.09; 'written': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'out?': 0.16; 'python;': 0.16; 'shutil': 0.16; "he's": 0.19; 'command': 0.19; 'header:In-Reply-To:1': 0.22; 'referring': 0.23; "i'm": 0.26; "doesn't": 0.28; 'about.': 0.29; 'least': 0.30; 'use?': 0.31; 'does': 0.31; 'however,': 0.31; 'to:addr:python-list': 0.32; "i've": 0.33; 'someone': 0.33; 'test': 0.33; 'using': 0.34; 'received:172.16': 0.35; 'file': 0.35; 'surely': 0.35; 'hello,': 0.36; 'think': 0.36; 'shows': 0.36; 'useful': 0.37; '20,': 0.38; 'apr': 0.38; 'but': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'might': 0.40; 'philip': 0.60; 'simple': 0.60; 'charset:windows-1252': 0.61; 'header :Message-Id:1': 0.62; 'extended': 0.64; 'lives': 0.64; 'safe': 0.65; 'want,': 0.72; '(snow': 0.84; 'empirical': 0.84; 'metadata': 0.84 Subject: Re: renaming files in OS X Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=windows-1252 From: Philip Semanchuk X-Priority: 3 (Normal) In-Reply-To: <20110420140240.534UB.124867.root@cdptpa-web13-z01> Date: Wed, 20 Apr 2011 11:35:29 -0400 Content-Transfer-Encoding: quoted-printable References: <20110420140240.534UB.124867.root@cdptpa-web13-z01> To: Python list X-Mailer: Apple Mail (2.1084) X-Scanned-By: MIMEDefang 2.67 on 152.16.195.41 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: 31 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303320319 news.xs4all.nl 41103 [::ffff:82.94.164.166]:53890 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3731 On Apr 20, 2011, at 10:02 AM, = wrote: > Hello, >=20 > I'm considering using os.rename or shutil for renaming=20 > files on OS X (Snow Leopard). However, I've read that=20 > shutil doesn't copy the resource fork or metadata for=20 > the files on OS X. I'm not sure about os.rename though. =20 > I need to keep the resource fork and metadata. Is it=20 > better if I just use os.system('mv =85') or is os.rename=20 > safe to use? Hi Jay, I don't know if os.rename() does what you want, but why don't you try a = simple test and find out? Surely an empirical test is at least as useful = as an answer from someone like me who may or may not know what he's = talking about. =3D) The OS X command xattr shows whether or not a file has extended = attributes, which are what I think you're referring to when you say = "metadata". xattr is written (badly) in Python; on my system it lives in = /usr/bin/xattr-2.6 You might also find this helpful: http://jonsview.com/mac-os-x-resource-forks Hope this helps Philip=