Jump to content

klofton

Member
  • Posts

    3
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Everything posted by klofton

  1. Im pretty new a vbscript. Can you give some insight on the search command for that file. Once the search is complete and it finds the file, how can I tell it to rename or Movefile from the search results? Everytime I try it errors out.
  2. Iceman, The servers are all webservers. Unfortunally the website names are all different and the directory structure maybe be different. For instance, some websites may reside on the D drive and some may reside on the C drive However the file name is the same on all the servers. (i.e C:\webapp\site\sitename1\folder1\filename.txt C:\webapp\site\sitename2\folder1\filename.txt D:\webapp\site\sitename3\folder1\filename.txt) There is no consistancy on the webservers which is the problem. The file in question needs to be renamed with a .old extention, and an new file needs to be copied to that same location. The file doesnt reside anywhere else but in a subdirectory under the sitename. This is what I have so far and you can see the issue. The script reads from a textfile that has all the webserver IP addresses. The first issue is that the "Trainingsite" directory in the string is always different on every webserver. Also the file needs to be renamed not copied over and an new file need to be copied to that location. Whew! I hope that was descriptive enough. Do you have any ideas or an easier way of doing this. Const ForReading = 1 Const OverwriteExisting = TRUE Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\Scripts\webservers.txt") Do Until objFile.AtEndOfStream strComputer = objFile.ReadLine strRenameFile = "\\" & strComputer & "\c$\WebAPP\Sites\Trainingsite\Train\SharedControls\test.txt" objFSO.CopyFile "C:\Scripts\test.txt", strRemoteFile, OverwriteExisting Loop
  3. Can anyone help with writing a script that will find a file in any directory, rename that file with extention .old, and copy an updated version to the location the file is located. The issue is that the directory is unknown or there is no consistency on what the directory is named and this needs to be performed on all network computers. Example \\server1\c$\folder1\filename.txt \\server2\d$\folderx\folder123\filename.txt (These represent the inconsistency to where the filename.txt resides on any server.) Filename.txt needs to be renamed to filename.txt.old and a new filename.txt need to be copied to that location. Can anyone help me. I am stuck. Thanks, KL
×
×
  • Create New...