Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: reading file name

HTVi
TV Discussion Newsgroups

reading file name
BrianB 6/1/2007 4:25:01 PM
I have a file name that gets a unique name each day. Example:
"4SLKOutgoing000869.240507". I need to read in the filename, extract the 6
digits before the ".". This example would be "000869". I'm using VBScript
and am going to it run using WSH. The file is the only one in the folder, so
I don't need to dig through a lot of file names.

Any help would be appreciated.

Thanks,
Brian
RE: reading file name
urkec 6/2/2007 4:50:01 PM
"BrianB" wrote:

[Quoted Text]
> I have a file name that gets a unique name each day. Example:
> "4SLKOutgoing000869.240507". I need to read in the filename, extract the 6
> digits before the ".". This example would be "000869". I'm using VBScript
> and am going to it run using WSH. The file is the only one in the folder, so
> I don't need to dig through a lot of file names.
>

theFolder = "C:\test\"

set fso = CreateObject _
("Scripting.FileSystemObject")
set folder = fso.GetFolder (theFolder)

for each file in folder.Files
WScript.Echo Right _
(fso.GetBaseName (file.Path), 6)
next
--
urkec

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen