Name: zackuk Date: January 22, 2008 at 00:23:16 Pacific Subject: Help I need a VB script OS: windows 2003 CPU/Ram: 2gb Model/Manufacturer: dell
Comment:
Hi I have got a script which gives me information in message boxes of users who have outlook archives file in their home directories.
the script is given below Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder("\\dc.eurasp\EAD\PorthusHome") Set fcf = f.SubFolders For Each ff in fcf If fso.FileExists(ff & "\outlook archives") Then msgbox(ff) End If Next Set fso = Nothing 1, I want some addition to this script so it can write the information in message boxes i.e the information of ff into a text file.
2. Using the above text file, I want the script to create a backup copy called outlook archives backup for all the users who have outlook archive file inside the same directory.
3. The last thing I want is the script to rename outlook archives file to outlook archives.pst
2) What's this about the log file? Do you expect to make two passes, once to make the log file, then do a second pass and read the log file? What would be the point of that?
2) What's being renamed here, the copy we're making, or the original?
You know what? I don't care anymore. If this doesn't work for you, clarify your requirements.
Set fso = CreateObject("Scripting.FileSystemObject") Set fOut = fso.OpenTextFile("log.txt", 8, True) fOut.WriteLine "[SoS] " & Now For Each ff In fso.GetFolder("\\dc.eurasp\EAD\PorthusHome").SubFolders If fso.FileExists(ff & "\outlook archives") Then With ff.Files("outlook archives") fOut.WriteLine .Path .Copy "outlook archives backup", True .Name = "outlook archives.pst" End With End If Next fOut.WriteLine "[EoS]" & Now & vbNewLine
This is the way it goes goes, I have a sample script as you have seen.
this sample script is good enough to show me user names of those users who have outlook archives file in their home directories which are located at \\dc.eurasp\EAD\PorthusHome.
I want 3 scripts
1. which logs information of users to a text file, the users who has got outlook archives file inside a home directory.
2. I want the second script to look for usernames in the text file, for every single user name found inside the text file, I want the script to go to that users home directory and create a backup copy of outlook archives file with a different name inside the same directory.
3. Lastly I want the 3 script to rename all the old outlook archive files, of the users which are listed in the text file created in script 1
I hope I am clear, I really appreciate your help and god bless u for that thanks
Untested, but I've more or less just spliced the working script apart.
Set fso = CreateObject("Scripting.FileSystemObject") Set fOut = fso.OpenTextFile("log.txt", 2, True) For Each ff In fso.GetFolder("\\dc.eurasp\EAD\PorthusHome").SubFolders If fso.FileExists(ff & "\outlook archives") Then _ fOut.WriteLine ff & "\outlook archives" Next
Set fso = CreateObject("Scripting.FileSystemObject") Set fIn = fso.OpenTextFile("log.txt", 1) Do Until fIn.AtEndOfStream Set f = fso.GetFile(fIn.ReadLine) f.Copy f.ParentFolder.Path & "\outlook archives backup", true Loop
Set fso = CreateObject("Scripting.FileSystemObject") Set fIn = fso.OpenTextFile("log.txt", 1) Do Until fIn.AtEndOfStream fso.GetFile(fIn.ReadLine).Name = "OUArchives" Loop
not working just i think minute compilation errors I'm pretty sure that isn't an error MS would give you, chief.
i dont know if we could do the same thing using a batch file? Sure, I'm not about to, as there are plenty of Command Script experts here. But you'll find free help lacking if, "It just don't work," is your idea of feedback.
Razor I am very sorry, if I come across rude I didnt mean to say anything to upset you, to be honest this is my first vb script which i am doing in my life, I always hated scripting and now i am stuck doing it. it was the first script which gave the error.
Well, I don't know what to tell you; it runs fine on both my XP and Vista box. If it doesn't work, you probably would be better off with a command script. Like I said, I'm not going to do one; too many cooks in that kitchen. Instead, I think I'm going to bed.
Set fso = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile("C:\users.txt") Set f = fso.GetFolder("\\dc.eurasp\EADFS\PorthusHome") Set fcf = f.SubFolders For Each ff in fcf If fso.FileExists(ff & "\outlook archives") Then oBjectfile.WriteLine ff
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE