Results 1 to 2 of 2

Thread: Bulk File Rename format string with data modified

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Earth,MiWaGa,LoGr,ViSuCl
    Beans
    310
    Distro
    Ubuntu 10.04 Lucid Lynx

    Bulk File Rename format string with data modified

    A fairly advanced question:

    I have a certain format string for almost every type of file. I have been "manually" (using pyrenamer, which rocks!) renaming them in bulk. I was wondering if there's a way to automatically (there has to be) set up a script so that certain files will be automatically renamed with a certain format string that uses their date-modified/date-created as part of the format string. I am guess this would involve some kind of cli script? I am not advanced as I'd want to be yet to write such a script but would love to learn.

  2. #2
    Join Date
    Nov 2007
    Location
    .mx
    Beans
    305
    Distro
    Ubuntu

    Re: Bulk File Rename format string with data modified

    Can't you simply call stat -c?

    Read in terminal:
    man stat

    Code:
           %x     Time of last access
    
           %X     Time of last access as seconds since Epoch
    
           %y     Time of last modification
    
           %Y     Time of last modification as seconds since Epoch
    
           %z     Time of last change
    
           %Z     Time of last change as seconds since Epoch

    Code:
    pato@toaster:/tmp$ touch privatepart
    pato@toaster:/tmp$ stat -c %y privatepart 
    2011-09-23 01:11:42.389941534 -0500
    pato@toaster:/tmp$ stat -c %Y privatepart 
    1316758302
    pato@toaster:/tmp$
    Should be enough to get you started.
    Shamelessly plugging my GLog! (GeekLog) in every post I can
    If your problem is solved, please do take the time to mention it and Mark the Thread as Solved!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •