philwitkowski
asked on
search servers for a specific folder, build a list, use robocopy to move the data, and then delete
Hello, I would like to thank all those who have posted here in the past. I have been able to put together many scripts that I need using parts from the post here. I have come to a point that I am stuck on two projects. Any help would be great.
Here is what I need to do using VBS or WMI. I need to search two specific paths on all the servers in our network, the server names are in a text file (server.txt) for a list of folders names (foldernames.txt). The path are fixed path: (example \\srvname\sharename\folder 1) If
If the specific folder is there, build another text file for the server names and folders. Once the folder name list and server search is complete, create a target folder on a specific server (example: \\archivesrv\foldername).
Once the sources are known and the target folder created, I want to use robocopy to run a move of the data from the source to the target creating a log file of the data. One of the issues I have is running a move job with robocopy on the same foldername from two sources at the same time.
Any ideas would be great
Here is what I need to do using VBS or WMI. I need to search two specific paths on all the servers in our network, the server names are in a text file (server.txt) for a list of folders names (foldernames.txt). The path are fixed path: (example \\srvname\sharename\folder
If the specific folder is there, build another text file for the server names and folders. Once the folder name list and server search is complete, create a target folder on a specific server (example: \\archivesrv\foldername).
Once the sources are known and the target folder created, I want to use robocopy to run a move of the data from the source to the target creating a log file of the data. One of the issues I have is running a move job with robocopy on the same foldername from two sources at the same time.
Any ideas would be great
ASKER
sstad,
First off, thanks for the post! After installing power shell on a XP machine, I ran the script. Updated for local information of course. I do not see any errors but on have the server name posted to the log file. I tried adding sharename\folder and \sharename\folder in the folders.txt file with no luck. Am I missing a step?
First off, thanks for the post! After installing power shell on a XP machine, I ran the script. Updated for local information of course. I do not see any errors but on have the server name posted to the log file. I tried adding sharename\folder and \sharename\folder in the folders.txt file with no luck. Am I missing a step?
My folders.txt looked like this:
\\server1\folder1
\\server2\folder2
\\server3\folder3
\\server4\folder4
\\server1\folder1
\\server2\folder2
\\server3\folder3
\\server4\folder4
ASKER
sstad,
I see what is happening, my result is the share folder name at the root of the server. What I am looking to do is search all the server names for a folder in the specific subfolder. For example, I want to search for a folder called "prj1234" (I could have a lot of them) on servers named: "server1, server2,server3, server4, etc" that are in a share called "data" If on any of the servers, make a list and run robocopy to copy "prj1234" from each server to the archive path. (one server at a time.)
I see what is happening, my result is the share folder name at the root of the server. What I am looking to do is search all the server names for a folder in the specific subfolder. For example, I want to search for a folder called "prj1234" (I could have a lot of them) on servers named: "server1, server2,server3, server4, etc" that are in a share called "data" If on any of the servers, make a list and run robocopy to copy "prj1234" from each server to the archive path. (one server at a time.)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sstad,
The subfolder was my issue!
Works great!
The subfolder was my issue!
Works great!
It than checks through a ping command if the server is still online. If it is the script continues. It than get all the folders that have the servername in it and puts these in an array. The script loops through the array to see if the folder exists. if is does it creates the new paths and copies the folder to the new location with robocopy.
Here is the script
Open in new window