I need to conditionally move a folder containing settings (files) for a client/server app from a server down to a client machine. Right now, I have a batch file written and in production that will create the necessary directory structure on the client where the setting files need to be placed and will also xcopy the files down to the client from the server.
Now, to further automate the process, I need an Experts' help to show me how to apply LOGIC onto the batch file. I need the batch file to:
(1) Check the network location for the files:
Inside of my current batch file, I am using the Windows %username% variable to direct the file copy. So therefore, on my server, I am placing the settings inside of a folder named based on the username. For example, user John Smith has all of his settings inside of a folder named "jsmith" which is on a network share. My user logs in and can run the batch file because Windows will go out and look for that folder on the network based on the value of %username% taken from the presently logged in user.
WHAT I NEED HELP WITH is to learn how to make the batch file check the network location automatically. These settings files are being placed onto the network location manually by myself, which is part of my process. I am placing the files there if I need to move someone. If I have placed the settings files inside of the user's folder, then I need the batch file to create the directory structure and copy them over (which is already written). However, IF the files are not there, I need the batch file to exit.
Below is the content of my batch file so far. You can see based on the above description that it needs LOGIC to check for these files on the network share:
c:
cd "c:\documents and settings\%username%\local settings\application data"
mkdir lotus
cd lotus
mkdir notes
cd notes
mkdir data
cd data
xcopy "\\server\share\Notes Moves\%username%" /h/i/q/r/y/s/e
Thanks in advance for your help. If I can get this working correctly, it will save me a tremendous amount of time and energy.
Start Free Trial