Friday, April 03, 2009

Nice little VBScript trick

To go from a path like this
D:\_pdf\a\b\c\foo.bar

to a path like this
D:\a\b\c\foo.bar

you can do this
sFile = "D:\_pdf\a\b\c\foo.bar"
sResult = Join(Split(sFile, "_pdf\",-1,1),"")

I just thought I'd share.

1 comment:

John said...

Works great, unless you're using UniCode based folder names on a 64-bit from certain foreign machines >.<

I'll have to see if there's a UniCode version of split that defines multiple separate characters.. tried it to remove my folder:

ショップ

it ripped it up =/

-
Junior