Log in

No account? Create an account
'Twas brillig, and the slithy toves did gyre and gimble in the wabe [entries|archive|friends|userinfo]

[ website | Beware the Jabberwock... ]
[ deviantArt | the-boggyb ]
[ FanFiction | Torkell ]
[ Tumblr | torkellr ]

[Random links| BBC news | Vulture Central | Slashdot | Dangerous Prototypes | LWN | Raspberry Pi]
[Fellow blogs| a Half Empty Glass | the Broken Cube | The Music Jungle | Please remove your feet | A letter from home]
[Other haunts| Un4seen Developments | Jazz 2 Online | EmuTalk.net | Feng's shui]

[Monday 13th August 2007 at 8:42 pm]

Reason for keeping good backups #35:

For when your renaming script runs amok and attempts to rename the files it just renamed. Not a particularly common reason for needing backups, but saves me having to work out how to make exiftool work.

In other news, cmd.exe apparently rescans the directory on each iteration of a for loop, such that it will iterate over new files. This can be useful, but not when the point of the loop is to rename files without moving them.
Link | Previous Entry | Share | Flag | Next Entry[ 3 pennies | Penny for your thoughts? ]

[User Picture]From: the_s_guy
Tuesday 14th August 2007 at 10:30 am (UTC)
Yah. The old

FOR /F "usebackq" %a in (`dir /b /a-d`) DO

to the rescue as usual, I take it?
(Reply) (Thread)
[User Picture]From: boggyb
Tuesday 14th August 2007 at 11:08 am (UTC)
Nah, I just added IF NOT !foo:~0^,1!==K (...) to the mess.

The full command was:
@for /d %I in (????) do @for /d %J in (%I\??) DO @for %K in (%J\*.jpg) do @(set foo=%~nK&& if not !foo:~0^,1!==K ( ( if !foo:~4^,2!==10 ( set bar=A) else ( if !foo:~4^,2!==11 ( set bar=B) else ( if !foo:~4^,2!==12 ( set bar=C) else ( set bar=!foo:~5,1!) ) ) ) && echo %K K!bar!!foo:~6,2!!foo:~20,4!.JPG && ren %K K!bar!!foo:~6,2!!foo:~20,4!.JPG ) )
It was used for bulk renaminmg of photos, as the default naming format from Kodak's software is pretty useless. I'd used exiftool previously to shift the metadata into the filename, but wanted to do some more formatting.

On a related note, do you know of a win32 touch equivalent that actually sets the creation datetime? All I've seen only handles modification datetime, and sometimes access datetime.
(Reply) (Parent) (Thread)
[User Picture]From: the_s_guy
Wednesday 15th August 2007 at 10:11 am (UTC)
eXpress Timestamp Toucher (freeware, GUI), DirDate (shareware, command line).

However FileTouch 2 (freeware, command line/GUI) might be more useful to you. It has a couple of features geared towards handling camera pics, and appears to be quite configurable.
(Reply) (Parent) (Thread)