Page 1 of 1 1
Topic Options
#59660 - 2001-10-09 12:21 AM Rename Directories
Anonymous
Unregistered


How can I rename a directory automatically through login scripts.

I need to rename h:\exchange to h:\outlook when a user logs in to the network

Anyone any suggestions

Top
#59661 - 2001-10-09 12:24 AM Re: Rename Directories
Anonymous
Unregistered


Use the following:

"shell %comspec% /c ren h:\exchange h:\outlook"

Martijn

[ 08 October 2001: Message edited by: MartijnL ]

Top
#59662 - 2001-10-08 01:49 PM Re: Rename Directories
Anonymous
Unregistered


I have give that a try, the code works but it does actually rename the dir. In our logs it says that it has been renamed. The code I am using is -

$Dir = "H:\Exchange"
if Exist("$Dir") = 1
shell "%comspec% /c" "ren h:\exchange" "h:\outlook"
IF @ERROR
$Dummy = WriteLine (1, " Error Renaming $Dir to Outlook"+ $CRLF)
Else
$Dummy = WriteLine (1, " Renamed $Dir to Outlook"+ $CRLF)
endif
endif

Top
#59663 - 2001-10-08 01:55 PM Re: Rename Directories
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Bruce ,

can't believe that you want to RENAME a directory on a Server each time a Client logs in !

Am i right ?

Jochen

_________________________



Top
#59664 - 2001-10-08 02:01 PM Re: Rename Directories
Anonymous
Unregistered


It isn't every time, this is part of an enviroment setup script as part of a migration to a new system. This only runs if the user doesn't have a log file in there home dir.

All users at the moment have dir called Exchange but with the new system we need it to be changed to outlook because some of the software we are using looks for outlook

Top
#59665 - 2001-10-08 02:08 PM Re: Rename Directories
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ok , I see ...

try the following :

code:

shell '%ComSpec% /C ren h:\exchange\ outlook'

hth

Jochen

_________________________



Top
#59666 - 2001-10-08 05:22 PM Re: Rename Directories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jochen,
Common mistake to specify drive on destination.
quote:

C:\>ren /?
Renames a file or files.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

C:\>


So, should be:

code:

shell '%comspec% /c ren "h:\exchange" "outlook"'

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#59667 - 2001-10-08 05:33 PM Re: Rename Directories
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Les,

have to contradict :

there is a space between \ and outlook !
trailing \ is to make clear that it's a directory not a file ... outlook is the new name ... tested on NT successful :

shell '%ComSpec% ren h:\exchange\ outlook >nul 2>nul'

sorry,not clearly documented in NT Help but working

Jochen

[ 08 October 2001: Message edited by: jpols ]

_________________________



Top
#59668 - 2001-10-08 06:07 PM Re: Rename Directories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jochen,
I was not trying to contradict your use of ren 'h:\exchange\', simply ribbing you for what I thought was your earlier mistake of '"ren h:\exchange" "h:\outlook"'. My mistake. I realize now it is Bruce I should be ribbing.

Both your example and mine work (tested on Win2k).

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#59669 - 2001-10-08 06:20 PM Re: Rename Directories
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
So now I should be confused !?!?

Say : Martijns example wouldn't work because of the additional h:\ in the target name ...

Yours AND mine work, allthough there's a significant syntax different (I guess the trailing backslash gets ignored if there's no such file in specified dir h: ???)

J.

_________________________



Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.058 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org