Print Story batch renaming in Windows?
By gzt (Fri May 09, 2008 at 05:42:06 AM EST) gzt, batch renaming (all tags)
Are there any utilities packaged with Windows to do efficient batch renaming? Just simple stuff like removing caps and maybe replacing bad characters in filenames (ie, spaces replaced with _ or something). Or even just the first.

I'm in a situation similar to a recent diary, where the user did not have the ability to install his own programs or whatever on his computer at work but still had to, like, actually get work done occasionally.

It'd be great if this were the case. Otherwise I will follow a two-step process: 1. send off e-mail to $ESOLUTIONS asking if they have a batch renaming tool 2. tell $ESOLUTIONS to batch rename these files by hand for me. It's only like 14 files, but this comes up often enough that I should just be able to run a script.

That's what I should do, I should brush up on however it is you do shell scripts in Windows and write my own script. No rules against that. Any links I would need here?

Fortunately, I will foist all projects that require this sort of nonsense in the future on THE NEW GUY. Unfortunately, she hasn't yet had the relevant training. SOON. THAT'S WHAT NEW PEOPLE ARE THERE FOR.

< Ugh | PIDFC, movies, stuff >
batch renaming in Windows? | 14 comments (14 topical, 0 hidden) | Trackback
VBScript is somewhat underated on this front. by ambrosen (2.00 / 0) #1 Fri May 09, 2008 at 05:48:21 AM EST
It's pretty nice really. No regexps, though. MSDN has most of it. Hey, I've got a book on my shelf about it.

vbscript does have regexps by clover kicker (2.00 / 0) #14 Fri May 09, 2008 at 02:22:45 PM EST
The syntax is utterly excruciating, but they're there.

[ Parent ]
Don't know if it will helps specifically with this by jayhawk88 (4.00 / 1) #2 Fri May 09, 2008 at 07:04:12 AM EST
Or not, but do a Google for Scripting Guys. MS Technet used to run a column by a couple of their script geniuses that would answer a lot of common "How do I do this" questions, a lot of esoteric topics like what you have. Again I don't know if they ever tackled anything like this specifically but good chance there is at least something that might help. There is a Windows help file available you can download that has all of them archived.

sweet, i'll check it out by gzt (2.00 / 0) #3 Fri May 09, 2008 at 07:13:33 AM EST
I do all sorts of esoteric crap.

[ Parent ]
Also by jayhawk88 (2.00 / 0) #7 Fri May 09, 2008 at 08:33:05 AM EST
You might want to take a look at PowerShell. There's a lot of really cool stuff you can do with it.

[ Parent ]
Character replacement by R Mutt (2.00 / 0) #4 Fri May 09, 2008 at 07:17:34 AM EST
I've got an old VBscript on my desktop that does file renaming. Doesn't do capitals but you could change it to use the UCase or LCase functions. Paste it into a file with a .vbs extension and play around.

Option Explicit

Dim fsoReader
Dim strDir
Dim strFrom
Dim strTo
Dim objFolder
Dim varFile
Dim strName
Dim lngCount

strDir = "F:\AudioBooks\Disk 4"
strFrom = " - Orphans - Disk 4 - "
strTo = "Orphans4 "
lngCount = 0

'Confirm values
strDir = InputBox("Enter folder", "Bulk rename", strDir)
strFrom = InputBox("Rename from", "Bulk rename", strFrom)
strTo = InputBox("Rename to", "Bulk rename", strTo)

Set fsoReader = CreateObject("Scripting.FileSystemObject")
Set objFolder = fsoReader.GetFolder(strDir)

'Get each file
For Each varFile in objFolder.Files
    'New name
    strName = CStr(varFile.Name)
    strName = Replace(strName, strFrom, strTo)

    If CStr(varFile.Name) <> strName Then
        varFile.Name = strName
        lngCount = lngCount + 1
    End If

MsgBox "Done. " & lngCount & " files were renamed"

VBScript reference by R Mutt (2.00 / 0) #5 Fri May 09, 2008 at 07:19:01 AM EST

[ Parent ]
Edit the file each time? by R Mutt (2.00 / 0) #12 Fri May 09, 2008 at 10:29:37 AM EST
Read the script... it's a GUI at the moment, but you could easily change it to use command line arguments if you prefer.

[ Parent ]
it isn't packaged with windows by Greener (2.00 / 0) #6 Fri May 09, 2008 at 08:28:48 AM EST
but I've used a free program calledLupas Rename to do that kind of thing in the past.

It's a standalone exe so it doesn't need to be installed if that helps.

we're not allowed to run any programs... by gzt (2.00 / 0) #8 Fri May 09, 2008 at 08:42:14 AM EST
...not installed by the IT dept. Though they let us do all the VBA and VBScript we want. I will not comment further on these useful programs others are providing. I ABIDE BY THE RULES.

[ Parent ]
There is by greyrat (2.00 / 0) #9 Fri May 09, 2008 at 08:46:21 AM EST
this, which requires nothing, but dosen't do much either.

at the last jackbooted workplace by clover kicker (2.00 / 0) #15 Fri May 09, 2008 at 02:27:42 PM EST
I had a floppy with AWK.EXE and SED.EXE.

When I needed to do junk like that I stuck the floppy in, did my thing, and ejected the floppy. Nosir, never installed nuthin' on this machine, nosir.

yar by fleece (2.00 / 0) #16 Fri May 09, 2008 at 04:08:13 PM EST

`for' is your friend by lm (2.00 / 0) #17 Sat May 10, 2008 at 04:30:26 AM EST
Modern flavors of windows actually have at least three scripting engines installed by default: batch (.bat), WSH and whatever the back end to .cmd files is (rexx?).

For small operations on multiple files within the same director a FOR loop on the command line should all you need. a WSH script done in VBS would probably be easier to wrap your mind around, though. The batch language will utterly screw up your mind six ways from Sunday.

There is no more degenerate kind of state than that in which the richest are supposed to be the best.
Cicero, The Republic
batch renaming in Windows? | 14 comments (14 topical, 0 hidden) | Trackback