I'll go from the start give you a full understanding.
Basically I have a bunch of files (peoples names eg smithj, jonesp, carterg etc.) and I needed it to create a folder with the same name and move the file to it.
eg. smithj.htm -> smithj/smithj.htm
Im using this to do that:
Const strFolderPath = "C:\testfiles"
Dim fso, objFolder, strFileLessExt
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(strFolderPath)
For each objFile in objFolder.Files
strFileLessExt = Left(objFile.Name, InStr(objFile.Name, ".") - 1)
If Not fso.FolderExists(strFolderPath & "\" & strFileLessExt) then
fso.CreateFolder(strFolderPath & "\" & strFileLessExt)
End If
objFile.Copy(strFolderPath & "\" & strFileLessExt & "\")
Next
set fso = Nothing
set objFolder = Nothing
That wasnt too bad to make...
The files are HTML files, and there is an image in them, named the same as the file.
I need the script to search the file and replace that string before it copies it into the new folder created in the above example.
eg. in smithj.htm is <img src="images/smithj.jpg"> this should be replaced with <img src="photo.jpg">
I know you need to read the file into a string search that then replce it but it a little above my knowledge.
Basically I have a bunch of files (peoples names eg smithj, jonesp, carterg etc.) and I needed it to create a folder with the same name and move the file to it.
eg. smithj.htm -> smithj/smithj.htm
Im using this to do that:
Const strFolderPath = "C:\testfiles"
Dim fso, objFolder, strFileLessExt
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(strFolderPath)
For each objFile in objFolder.Files
strFileLessExt = Left(objFile.Name, InStr(objFile.Name, ".") - 1)
If Not fso.FolderExists(strFolderPath & "\" & strFileLessExt) then
fso.CreateFolder(strFolderPath & "\" & strFileLessExt)
End If
objFile.Copy(strFolderPath & "\" & strFileLessExt & "\")
Next
set fso = Nothing
set objFolder = Nothing
That wasnt too bad to make...
The files are HTML files, and there is an image in them, named the same as the file.
I need the script to search the file and replace that string before it copies it into the new folder created in the above example.
eg. in smithj.htm is <img src="images/smithj.jpg"> this should be replaced with <img src="photo.jpg">
I know you need to read the file into a string search that then replce it but it a little above my knowledge.