Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3740

RE: renaming files in OS X

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jyoung79@kc.rr.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; '(although': 0.05; 'admit': 0.09; 'attributes,': 0.09; 'structure.': 0.09; 'subject:files': 0.09; 'scripts': 0.10; 'written': 0.12; 'earlier,': 0.16; 'os.name': 0.16; 'out?': 0.16; 'python;': 0.16; 'shutil': 0.16; 'far.': 0.19; "he's": 0.19; 'command': 0.19; 'code': 0.22; 'referring': 0.23; 'tests': 0.26; "i'm": 0.26; 'testing': 0.28; 'about.': 0.29; 'received:75': 0.30; 'least': 0.30; 'far,': 0.31; 'ran': 0.31; 'does': 0.31; 'to:addr:python-list': 0.32; 'done': 0.32; 'thank': 0.32; 'someone': 0.33; 'bit': 0.33; 'test': 0.33; 'using': 0.34; 'actually': 0.34; 'file.': 0.34; 'file': 0.35; 'received:rr.com': 0.35; 'received:mail.rr.com': 0.35; 'surely': 0.35; 'quite': 0.36; 'running': 0.36; 'think': 0.36; 'shows': 0.36; 'some': 0.37; 'useful': 0.37; 'but': 0.38; 'files': 0.38; 'used': 0.38; 'help': 0.39; 'to:addr:python.org': 0.39; 'might': 0.40; 'simple': 0.60; 'from:no real name:2**0': 0.60; 'link': 0.62; 'extended': 0.64; 'lives': 0.64; 'believe': 0.66; 'want,': 0.72; '(snow': 0.84; 'empirical': 0.84; 'ignorant': 0.84; 'jay': 0.84; 'this!': 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=EjEMWyxPAAAA:8 a=G2f8TNbggD34NL8P3yUA:9 a=QEXdDO2ut3YA:10 a=y39esTi0mrZmY3GbTNZSyg==:117
X-Cloudmark-Score 0
Date Wed, 20 Apr 2011 19:00:56 +0000
From <jyoung79@kc.rr.com>
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 7bit
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.666.1303326059.9059.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 82.94.164.166
X-Trace 1303326059 news.xs4all.nl 81483 [::ffff:82.94.164.166]:46299
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3740

Show key headers only | View raw


>> I'm considering using os.rename or shutil for renaming 
>> files on OS X (Snow Leopard)...

> 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. =)

> 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


Hi Philip,

Thank you very much for your reply.  This actually does 
help a lot!  I had done a bit of testing earlier, but
I admit I'm quite ignorant on Apples file structure.
Your excellent link had some great info and I did a
few tests with what it had to say before and after I
ran os.rename on a file.  I also ran some applescript
code to get the file/creator type before and after
os.name (although I don't believe these types are
actually part of the resource fork, they're still used
by some scripts we run).  So far, after running
os.name, the file still contains everything I can think
of so far.

Again, thank you for your help with this!

Jay

Back to comp.lang.python | Previous | Next | Find similar


Thread

RE: renaming files in OS X <jyoung79@kc.rr.com> - 2011-04-20 19:00 +0000

csiph-web