Hello,

I'm having an issue where I'm trying to create a script that parses through
an input file where the lines in the input file is a folder path or a file
name with the full path to the file, and that file or folder needs to be
copied over to another location. For instance, the input file would look like
this:

c:\webroot\www.sheeltest.org\files\pdf\test1.pdf
c:\webroot\www.sheeltest.org\files\pdf\test2.pdf
c:\webroot\www.sheeltest.org\meeting\testmeeting\testmeeting.pdf
c:\webroot\www.sheeltest.org\meeting\2008meeting\

The destination for these files would be:

c:\webroot\www.sheelprod.org\files\pdf\test1.pdf
c:\webroot\www.sheelprod.org\files\pdf\test2.pdf
c:\webroot\www.sheelprod.org\meeting\testmeeting\testmeeting.pdf
c:\webroot\www.sheelprod.org\meeting\2008meeting\

Is there a way to do this? Any help is appreciated.

Thanks a lot!
Sheel

Re: Verification of input as a file or a folder by Paul

Paul
Thu Nov 29 12:17:36 PST 2007

Assuming the lines are separated by carriage return line feed,
maybe something like this; you may want to add error checking:

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each strLine in Split(objFSO _
.OpenTextFile("YOUR INPUT FILE PATH GOES HERE", ForReading).ReadAll,
vbCrLf)
If objFSO.FolderExists(strLine) Then
objFSO.CopyFolder(strLine, Replace(strLine, "sheeltest.org\",
"sheelprod.org\")
ElseIf objFSO.FileExists(strLine) Then
objFSO.CopyFile(strLine, Replace(strLine, "sheeltest.org\",
"sheelprod.org\")
Else
MsgBox strLine & vbCrLf & "File/Folder by this name does not exist"
End If
Next

-Paul Randall

"Sheel" <Sheel@discussions.microsoft.com> wrote in message
news:D065E35E-FA34-4BC2-B811-175E1A41681A@microsoft.com...
> Hello,
>
> I'm having an issue where I'm trying to create a script that parses
> through
> an input file where the lines in the input file is a folder path or a file
> name with the full path to the file, and that file or folder needs to be
> copied over to another location. For instance, the input file would look
> like
> this:
>
> c:\webroot\www.sheeltest.org\files\pdf\test1.pdf
> c:\webroot\www.sheeltest.org\files\pdf\test2.pdf
> c:\webroot\www.sheeltest.org\meeting\testmeeting\testmeeting.pdf
> c:\webroot\www.sheeltest.org\meeting\2008meeting\
>
> The destination for these files would be:
>
> c:\webroot\www.sheelprod.org\files\pdf\test1.pdf
> c:\webroot\www.sheelprod.org\files\pdf\test2.pdf
> c:\webroot\www.sheelprod.org\meeting\testmeeting\testmeeting.pdf
> c:\webroot\www.sheelprod.org\meeting\2008meeting\
>
> Is there a way to do this? Any help is appreciated.
>
> Thanks a lot!
> Sheel