Lanwench
Wed Jan 31 20:17:14 CST 2007
In news:eVtoaLMRHHA.488@TK2MSFTNGP06.phx.gbl,
Paul Randall <paulr901@cableone.net> typed:
> "Lanwench [MVP - Exchange]"
> <lanwench@heybuddy.donotsendme.unsolicitedmail.atyahoo.com> wrote in
> message news:%23ayiVOCRHHA.1212@TK2MSFTNGP03.phx.gbl...
>> In news:ugNlJE8QHHA.2252@TK2MSFTNGP02.phx.gbl,
>> Paul Randall <paulr901@cableone.net> typed:
>>> "Lanwench [MVP - Exchange]"
>>> <lanwench@heybuddy.donotsendme.unsolicitedmail.atyahoo.com> wrote in
>>> message news:uJftlm6QHHA.1208@TK2MSFTNGP03.phx.gbl...
>>> The four-line statement below will probably change the name to what
>>> you want.
>>> objFile.Name = Left(objFile.Name, 5) & _
>>> "20" & Mid(objFile.Name, 12, 2) & _
>>> Mid(objFile.Name, 5, 7) & _
>>> Right(objFile.Name, Len(objFile.Name) - 16
>>>
>>> -Paul Randall
>>
>>
>>
>> Re the yyyy - I think they've got some older files in this tree, but
>> it's also possible someone has already moved the pre-Y2k stuff out
>> to another volume where they used to do their archiving.
>
> If Windows Explorer shows the correct date, VBScript can use it in
> the file name.
>
>> So, bearing in mind that I'm a complete tyro here, I'd take the
>> above four lines and save them in a whatever.vbs file ...yes? And I
>> need to find out how to run this against the tree so it will
>> iteratively run through all the subfolders. Do you know a decent
>> site I can check out that spells out this sort of thing
>> (vbscripting, particularly) in introductory terms, for the lay
>> person?
>
> Yes, starting at a base folder, the script can recurse through that
> folder and all levels of subfolders to rename the files within those
> folders.
>> I'm going to run the questions by my client (w/r/t the fixed-length
>> question) and will report back. I'll probably grab a copy of a few
>> folders/subfolders to play with, so I can test this without running
>> the risk of making a huge mess I don't know how to clean up. The
>> witness protection program won't take me on; I already asked.
>>
>> Again, your help is very much appreciated.
>>
> There are a few essentials you need to learn scripting.
> 1. The scripting execution engine. If you have Internet Explorer,
> then you have some version of Microsoft's VBScript and JScript
> engines. If you have IE6, then you probably have the latest version.
> Microsoft says it will not provide any more updates to VBScript. If
> you want to upgrade due to an old version, you need to know that
> different versions of Windows may require different versions of the
> scripting engine. For W2K and WXP, download here:
>
http://www.microsoft.com/downloads/details.aspx?FamilyID=c717d943-7e4b-4622-86eb-95a22b832caa&DisplayLang=en
>
> 2. The documentation is definitely not perfect, but has an excellent
> index and examples of use of most key words in both VBScript and
> JScript. The examples are aimed towards script usage within HTML
> pages. I think this project is more of a stand-alone application. Some
> translation is needed to test the sample code in a stand-alone
> situation. Download docs here:
>
http://www.microsoft.com/downloads/details.aspx?FamilyID=01592c48-207d-4be1-8a76-1c4099d7bbb9&DisplayLang=en
>
> Read the VBScript User's Guide section - its listed in the index.
>
> 3. An editor that can save plain text files with the extension .VBS.
> Notepad will do, but debugging is tedious with Notepad. When an error
> occurs, the scripting engine tells you the line number and some other
> info about the problem. About the second time you have to find line
> 111 in a script you will understand the need for easily getting to a
> particular line. If you have any Microsoft Office applications
> installed, then you likely have an excellent editor called VBE
> installed and perhaps the Microsoft's script debugger. I currently
> use a free multi-scripting-language editor, PSPad, available from
>
http://www.pspad.com/en/; it has few or no nags. A VBScript-only
> editor I've started using which can do more for VBScripters, but nags
> when you try to access a feature only available in the non-free
> version, is VBSEdit, from www.vbsedit.com.
> The best source of Windows scripting info is
>
http://www.microsoft.com/technet/scriptcenter/default.mspx
> Novices should read the link for Scripting: Your First Steps
>
> There are a few places with tutorials on VBScript but they are
> usually aimed at VBScript in a web server and VBscript in a web page.
> After some stumbling around, I think you will quickly learn to ignore
> the stumbling blocks.
>
> Googleing for the word free followed by the phrase in quotes
> "vbscript code" will provide links to both code and tutorials.
>
>
http://www.w3schools.com/ has a lot of good tutorials/sample code,
> but all is aimed at web pages. For playing with this, I sometimes
> use a free editor from www.coffeecup.com. It's line numbering
> feature is somewhat broken, but you can paste samples from HTML
> tutorials into the editing tab window and then switch to the preview
> tab to see that HTML rendered, and interact (click, fill in boxes,
> etc), just as if you had saved the code and opened it in a browser. Its
> quick and easy to switch between modifying a script and seeing
> the result of that modification.
> There are lots of places with sample code which can be cut and pasted
> into your projects. Often the sample code is poorly documented, but
> it is still valuable in getting you going in the right direction. There
> are many different ways to do the same thing. Ten commented
> statements understandable only to a scripting Guru might produce the
> same result as 100 uncommented statements understandable by a novice.
> When things go wrong, its is nice to be working with code you kind
> of understand.
> As you browse Microsoft's newsgroups, pay particular attention to
> answers by MVPs. These people have demonstrated the ability to
> provide good information in the newsgroup. Scripts they post often
> contain useful routines and techniques.
>
> Many of the MVPs have web sites with excellent sample code like
> Alex Angelopolous'
http://dev.remotenetworktechnology.com/ and
> Richard Mueller's
http://www.rlmueller.net/products.htm
> They often list their web site in their signature.
>
> Go to Alex's site, navigate to the WSH and VBScript items and browse
> comment lines in most of the routines so you can get an idea of whats
> there -- you will probably come back and get things of interest.
>
> -Paul Randall
Thank you again, Paul - I'll take all your advice under consideration. The
client is now rethinking the decision to script this stuff anyway, as it
turns out the file naming convention they've been using isn't actually very
consistent - and this makes it somewhat a moot point for the moment. I do
need to get up to snuff on this sort of thing, though, I think - and I
appreciate your help. I do pay attention to MVP answers....it'd be silly for
me not to. :-)