Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help batch file

Status
Not open for further replies.

aalva

IS-IT--Management
Feb 16, 2003
12
0
0
PE
Hi guys, i have a question and need some help

We need to do a batch file to copy a text file (about 4 K of a txt) into specific folders on my file servers. The thing could be like this


I have one root server LIM.PERU where the batch should be in LIM.PERU\VOL1\USER\file.txt
we have another OU in AND.PERU, CAM.PERU and TRO.PERU

we need to make a batch to copy file.txt to

AND.PERU\VOL1\USERTRO.PERU\VOL1\USERCAM.PERU\VOL1\USER
what do i do
 
Well, it could be as easy as:
copy //LIM.PERU\VOL1\USER\file.txt //AND.PERU\VOL1\USERcopy //LIM.PERU\VOL1\USER\file.txt //TRO.PERU\VOL1\USERcopy //LIM.PERU\VOL1\USER\file.txt //CAM.PERU\VOL1\USER
But, there are other considerations. Such as where and who is going to run this batch? Do you need it to run in a login script? Or is an Admin going to do it? If the user is going to run this either through a login script or a command line then you need to make sure they can both "see" all the servers, and have rights to the directories.

Also, Novell does not really like UNC mappings, it works better with drive mappings. Is the person who is going to use this, mapping to all these servers? If not you can map them in the batch, no problem, if they have rights before hand.

Like so:
MAP G:=AND.PERU\VOL1:USER
COPY F:\USER\FILE.TXT G:MAP DEL G:

And so on.

Hope this helps.

JON
 
Well, it could be as easy as:
copy //LIM.PERU\VOL1\USER\file.txt //AND.PERU\VOL1\USERcopy //LIM.PERU\VOL1\USER\file.txt //TRO.PERU\VOL1\USERcopy //LIM.PERU\VOL1\USER\file.txt //CAM.PERU\VOL1\USER
But, there are other considerations. Such as where and who is going to run this batch?

The PERSON WHO RUN THE BATCH IS THE ROOT ADMIN

Do you need it to run in a login script? Or is an Admin going to do it? If the user is going to run this either through a login script or a command line then you need to make sure they can both "see" all the servers, and have rights to the directories.

IT HAS TO BE IN A BATCH FILE

Also, Novell does not really like UNC mappings, it works better with drive mappings. Is the person who is going to use this, mapping to all these servers? If not you can map them in the batch, no problem, if they have rights before hand.


Like so:
MAP G:=AND.PERU\VOL1:USER
COPY F:\USER\FILE.TXT G:MAP DEL G:
 
Well, that should work then. but I'll bet you need to do this for a bunch of people correct?

If so you can try something like this;

MAP G:=AND.PERU\VOL1:%1
COPY F:\%1\FILE.TXT G:MAP DEL G:

Then form the command line you would run your batch with a variable input. Lets say the batch is called move.bat.

So you would type something like this:

move.bat jsmith

This would run the batch and insert jsmith where ever the %1 was found. This would not be very workable for hundreds of users, too tedious.
If you have to hundreds I would run a batch from the Login script.

It would look something like this:

MAP MAP G:=AND.PERU\VOL1:%LOGIN_NAME
MAP MAP H:=TRO.PERU\VOL1:%LOGIN_NAME
MAP MAP I:=CAM.PERU\VOL1:%LOGIN_NAME

(This would make the users directory according to who the person logging in was.)

COPY F:\%LOGIN_NAME\FILE.TXT G:COPY F:\%LOGIN_NAME\FILE.TXT H:COPY F:\%LOGIN_NAME\FILE.TXT I:
(This would copy the file, of course.)

MAP DEL G:
MAP DEL H:
MAP DEL I:

(This would remove the drive mappings so they can remap normally)

EXIT

JON
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top