Do Until rs.Eof theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "/")) If fso.FolderExists(theFolder) = False Then createFolder(theFolder) End If stream.SetEos() stream.Write rs("fileContent") stream.SaveToFile str & rs("thePath"), 2 rs.MoveNext Loop