[linux] Ako premenovat 1500 fotiek

Ing. Jan ONDREJ jan.ondrej na upjs.sk
Čtvrtek Září 21 17:08:00 CEST 2006


V pythone asi takto:

-----------------------------------------------------------------------
#!/usr/bin/python
'''
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
'''

import os,time

c=0
for fn in os.listdir('.'):
  c+=1
  nfn="%s---%05d" % (
    time.strftime('%Y-%m%d_%H%M',time.localtime(os.stat(fn).st_mtime)),c)
  print "%s -> %s" % (fn,nfn)
  os.rename(fn,nfn)

-----------------------------------------------------------------------
:-)

Dalsia dobra utilitka je "rename", ale prave toto asi nevie.

				SAL

On Thu, Sep 21, 2006 at 04:41:15PM +0200, Jan Kunder wrote:
> Ahoj.
> V tcmd som to robil takto
> [Y]-[M][D]_[hm]---0[C2362]
> co premenovalo COKOLVEK na rok-mesiacden_hodinaminuta(s0 na 
> zaciatku)---0(a counter+1 od daneho cisla)
> 
> Spoliehal som na Krename, showimg, gwenview, ale nic mi nevie ponuknut 
> taketo IMHO jednoduche premenovanie.
> Takze - viete mi poradit utilitku // bash-script ako vytiahnut mdate a 
> mtime zo suboru a takto ho premenovat ^ aplikovat to na vsetky subory?
> 
> Dakujem vopred.
> 
> 
> PS:
> http://packages.debian.org/testing/utils/renameutils
> http://packages.debian.org/testing/utils/mrename
> su o nicom a doslova by som sa hanbil ist za susedom na win, kde si ich 
> premenujem :)
> 
> 
> 
> 
> 've a nice day!
> 
> JK
> 
> --
> Ing. Jan Kunder
> jan.kunder-HATESPAM-gmail.com
> http://www.kunder.sk
> JKjkjk rozpmnqestka

> _______________________________________________
> https://lists.linux.sk/mailman/listinfo/linux
> Prehladavanie archivu: http://search.lists.linux.sk
> Meta FAQ: http://www.sklug.sk/lists/linux/metafaq.html



Další informace o konferenci linux