What we did at UBZ
John A Meinel
john at arbash-meinel.com
Fri Nov 18 16:33:24 GMT 2005
Jan Nieuwenhuizen wrote:
> John A. Meinel writes:
>
>> for f in os.listdir('.'):
>> if not (f.startswith('test') and f.endswith('.py')):
>> continue
>> if f.startswith('test_'):
>> g = f[5:]
>> else:
>> g = f[4:]
>> bzr mv f g
>>
>
> Can't you do something like
>
> import glob, re
> for i in glob.glob ('test_*py'):
> print 'mv %s %s' % (i, re.sub ('^test_*', '', i))
>
> in ipython? Or just do
>
> rename 'test_*' '' test_*.py
Well, I want to get rid of both "test_" and "test".
And I want to spawn "bzr mv" since that also updates the bzr metadata.
alias bzr bzr %l
import glob, re
for f in glob.glob ('test*py'):
g = re.sub ('^test_?*', '', f)
bzr mv $f $g
Regardless, I mostly just wanted to mention the ipython shell, which is
a nice hybrid of python and shell.
Yes 'rename' would move the files, but I need to use "bzr mv" so that it
updates the metadata as well.
John
=:->
>
> FTM?
>
> Jan.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051118/9d5ca90d/attachment.pgp
More information about the bazaar
mailing list