Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Python Bulk-Renamer for Date-Modified

Python Bulk-Renamer for Date-Modified

Scheduled Pinned Locked Moved JavaScript
linuxtutorialpython
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johtnkucz
    wrote on last edited by
    #1

    #There was no python sub-category forum, so posted this here. --------------------- Hey mates, on ubuntu-linux. I need/want to code a python applicaton that does the following: takes the 'date-modified' of the file (almost always a .jpg jpeg) and adds a 8 digit format string to the beginning of it. I have manually using pyrenamer to rename them. When I have many files all on the same date. this works, but but but, when I have many files on different dates this is tedious. the format string would be: EXAMPLE; file modified on 2012-17-Mar change name to 20120317_num where num is just a two digit numbe 01,02,... Any ideas on how I would start to code such an app. It is a relatively simple process but I fear it will be complex to code and outside of my skill-level and will need to research a lot of things like how to get the date-modified information manipulating/changing the string of 2012-17-Mar I could see a lot of if-elses for the 12 months and whatnot. Relatively simple concept; currently outside of my abilities as a coder, but this would be great to code. If anyone has any resources on how to do this, would be rewarding for me to code, would be freakishly useful, and would safe time. thanks! pyrenamer is super bulk-file-renamer (the best i've seen across mac, windows, and linux OSes) but that specific usage where it takes the file format etc is complex. I guess I would rather find such an app (to process files) AND THEN code a separate one for the reward of coding. Recently i've been making folders of month and then subfolders of day and putting corresponding date-modified files in the month/day folder and then using pyrenamer. again, tedious when have many 'different days' of date-modified.

    D 1 Reply Last reply
    0
    • J johtnkucz

      #There was no python sub-category forum, so posted this here. --------------------- Hey mates, on ubuntu-linux. I need/want to code a python applicaton that does the following: takes the 'date-modified' of the file (almost always a .jpg jpeg) and adds a 8 digit format string to the beginning of it. I have manually using pyrenamer to rename them. When I have many files all on the same date. this works, but but but, when I have many files on different dates this is tedious. the format string would be: EXAMPLE; file modified on 2012-17-Mar change name to 20120317_num where num is just a two digit numbe 01,02,... Any ideas on how I would start to code such an app. It is a relatively simple process but I fear it will be complex to code and outside of my skill-level and will need to research a lot of things like how to get the date-modified information manipulating/changing the string of 2012-17-Mar I could see a lot of if-elses for the 12 months and whatnot. Relatively simple concept; currently outside of my abilities as a coder, but this would be great to code. If anyone has any resources on how to do this, would be rewarding for me to code, would be freakishly useful, and would safe time. thanks! pyrenamer is super bulk-file-renamer (the best i've seen across mac, windows, and linux OSes) but that specific usage where it takes the file format etc is complex. I guess I would rather find such an app (to process files) AND THEN code a separate one for the reward of coding. Recently i've been making folders of month and then subfolders of day and putting corresponding date-modified files in the month/day folder and then using pyrenamer. again, tedious when have many 'different days' of date-modified.

      D Offline
      D Offline
      Diana Weiss
      wrote on last edited by
      #2

      I did something similar with BASH a while ago, to rename files according to their modification date:

      saveIFS="$IFS"; IFS=$'\0'; while read -a line; do mv "${line[1]}" "${line[0]%.*}.${line[1]}"; done < <(find -maxdepth 1 -type f -printf "%T+\0%f\n"); IFS="$saveIFS"

      Hope it helps!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups