From: "Dave "Crash" Dummy" on
Oleg wrote:
> Dave, Can you explain couple of things in you script? Im trying to
> understand how it works. 1. You set d as Scripting Distionary - d
> must be there or any word or letter can be set as S.Dictionary?

Any letter or unrestricted word (a word not reserved by VBScript) can be
used.

> 2. In line if right(filename,4)=".jpg" then - what does 4 stand
> for?

4 is the number of characters from the end of the string.
Right("characters",4) would be "ters"

> 3. Also in line d.Add newname,1 im wondering what 1 means...

"1" is the initial item for the newname key. That's where the numeric
suffix for your new filename will come from. It will increase by one
whenever a duplicate date-time string occurs.

I strongly suggest you download the VBScript help file and look up
"dictionary" and other terms used in the script Sorry. It is only available
in English. Watch for line wrap!

http://download.microsoft.com/download/9/1/d/91dfd1b3-a274-4e17-a376-f605ff39c58c/script56.chm

Bookmark this site:
http://msdn.microsoft.com/en-us/library/t0aew7h6(v=VS.85).aspx

> Thanks for your time and patience! :)

--
Crash

Ignorance is curable. Stupidity is refusing treatment.
From: Oleg on
Dave,
Thanks, that will occupy me for some time. Its much more fun to work with
scripts that win GI ;-) and a lot to learn...

"Dave "Crash" Dummy" wrote:

> Oleg wrote:
> > Dave, Can you explain couple of things in you script? Im trying to
> > understand how it works. 1. You set d as Scripting Distionary - d
> > must be there or any word or letter can be set as S.Dictionary?
>
> Any letter or unrestricted word (a word not reserved by VBScript) can be
> used.
>
> > 2. In line if right(filename,4)=".jpg" then - what does 4 stand
> > for?
>
> 4 is the number of characters from the end of the string.
> Right("characters",4) would be "ters"
>
> > 3. Also in line d.Add newname,1 im wondering what 1 means...
>
> "1" is the initial item for the newname key. That's where the numeric
> suffix for your new filename will come from. It will increase by one
> whenever a duplicate date-time string occurs.
>
> I strongly suggest you download the VBScript help file and look up
> "dictionary" and other terms used in the script Sorry. It is only available
> in English. Watch for line wrap!
>
> http://download.microsoft.com/download/9/1/d/91dfd1b3-a274-4e17-a376-f605ff39c58c/script56.chm
>
> Bookmark this site:
> http://msdn.microsoft.com/en-us/library/t0aew7h6(v=VS.85).aspx
>
> > Thanks for your time and patience! :)
>
> --
> Crash
>
> Ignorance is curable. Stupidity is refusing treatment.
> .
>
From: Al Dunbar on


"Oleg" <Oleg(a)discussions.microsoft.com> wrote in message
news:7E1844E7-9C35-44CB-A7AF-0084C603B62B(a)microsoft.com...
> Sorry for the bad formulation of my question :) English is not my native
> lang., and still new to this forum, will try to be more specific in next
> posts ;)
> Still, I didnt get any OT replies :)

No problem. My comments were not meant as criticism, but to try to
demonstrate that your question could have been worded more effectively.

/Al

> "Al Dunbar" wrote:
>
>>
>>
>> "James Watkins" <someone(a)microsoft.com> wrote in message
>> news:ORXo4OOBLHA.1888(a)TK2MSFTNGP05.phx.gbl...
>> >
>> > "Dave "Crash" Dummy" <invalid(a)invalid.invalid> wrote in message
>> > news:cAqOn.91072$rE4.32891(a)newsfe15.iad...
>> >> Oleg wrote:
>> >>> Can someone tell if its possible to replace the basename of a number
>> >>> of .jpg files in specified folder to match their date stamp?
>> >>> file.DateCreated can see that date, but how can I actually rename the
>> >>> files? Thanks!
>> >>
>> >> The script below will do what you want. I recommend using
>> >> DateLastModified instead of DateCreated. That is what is displayed in
>> >> Explorer. The DateCreated changes every time the file is copied.
>> >>
>> >> The date-time string contains illegal characters for a filename (/,:),
>> >> so
>> >> those have to be replaced. Another possible trouble spot, one that is
>> >> not dealt with in this script, is two files having the same date-time.
>> >>
>> >> '=================rename.vbs================
>> >> set fso=CreateObject("Scripting.FileSystemObject")
>> >> set objFolder=fso.getFolder("d:\pics")
>> >>
>> >> for each file in objFolder.files
>> >> filename=LCase(file.name)
>> >> if right(filename,4)=".jpg" then
>> >> newname=file.dateLastModified
>> >> newname=replace(newname,"/","-")
>> >> newname=replace(newname,":","-")
>> >> file.name=newname & ".jpg"
>> >> end if
>> >> next
>> >> '=========================================
>> >> --
>> >> Crash
>> >>
>> >> "Something there is that doesn't love a wall, that wants it down."
>> >> ~ Robert Frost ~
>> >
>> > The OP's question was "Can someone tell if its possible to replace the
>> > basename of a number of .jpg files in specified folder to match their
>> > date
>> > stamp?". Your comprehensive reply reminds me of the saying "Give a man
>> > a
>> > fish; you have fed him for today. Teach a man to fish; and you have fed
>> > him for a lifetime".
>>
>> Nice observation. The OP should now be able to eat "datestamped file"
>> fish
>> for the rest of his life. Not so sure that he will be able to eat "asking
>> the intended question" fish ;-)
>>
>> To the OP: if you are confused by my comment, what I mean is that you
>> probably meant to ask "How can I write a script to replace...". In the
>> old
>> days a question such as yours would likely get numerous responses of
>> these
>> varieties:
>>
>> "Yes, someone probably could tell you whether or not it is possible..."
>> "Yes, it is possible..."
>>
>> /Al
>>
>>
>> .
>>