Page 1 of 1 1
Topic Options
#15230 - 2001-12-15 12:29 AM Renaming a Folder???
Anonymous
Unregistered


Help! I've got a folder on the C: drive that I need to rename. I see that I can remove it (RD) and create a new one (MD), but can I rename the existing one?

Anyone who knows the command, well, I'll owe you.

Top
#15231 - 2001-12-15 01:14 AM Re: Renaming a Folder???
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Hi Guy,

there is no kix command for it, but you can do:

Shell '%comspec% /c rename C:\folder newname'

HTH

_________________________
The Code is out there

Top
#15232 - 2001-12-15 01:19 AM Re: Renaming a Folder???
Anonymous
Unregistered


Yeah, thanks. I'm trying to keep the dos boxes from flying all over the screen, or atleast to a minimal. But, since there's no kix command for it....
Top
#15233 - 2001-12-15 02:32 AM Re: Renaming a Folder???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello ComputerGuy3113,

Sorry, but as you stated... KiXtart does not have a built in command for RENAME

Here is some code to perform the task...

code:
BREAK ON
CLS
$MyDrive="c:\"
$OldName="FOLDER001"
$NewName="FOLDER002"
IF (Exist($MyDrive+$NewName)=1) AND (Exist("$MyDrive"+$OldName)=1)
? "Warning... Both folders exist. You will have to manually decide what to do."
GOTO END
ENDIF
IF (Exist($MyDrive+$NewName)=1)
IF GetFileAttr($MyDrive+$NewName) <> 16
? "$NewName is a file, not a directory... You will need to delete or rename this file before creating a folder."
GOTO END
ELSE
IF GetFileAttr($MyDrive+$NewName) & 16
? "The Folder $NewName already exists. Quitting, nothing to do..."
GOTO END
ENDIF
ENDIF
ENDIF


IF (Exist($MyDrive+$OldName) = 1)
IF GetFileAttr($MyDrive+$OldName) & 16
? "Name exists and is a directory. We will now rename the folder..."
Shell '%comspec% /c rename $MyDrive$OldName $NewName'
ELSE
? "$OldName is a file, not a directory... You will need to delete or rename this file before creating a folder."
ENDIF
ELSE
? "File/Directory not found... Making directory $NewName"
Shell '%comspec% /c MD $MyDrive$NewName'
ENDIF

:END


Let the DOS BOX fly... Set it free

[ 15 December 2001: Message edited by: NTDOC ]

Top
#15234 - 2001-12-20 11:07 AM Re: Renaming a Folder???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hey ComputerGuy3113,

Did this work or was it a waste of your time? Just curious...

Top
#15235 - 2001-12-20 06:27 PM Re: Renaming a Folder???
Anonymous
Unregistered


NTDOC, thanks for the info. I've been out sick the past few days and haven't been able to really go through it. Appreciate the help though. Will let you know.
Top
Page 1 of 1 1


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

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

Generated in 0.053 seconds in which 0.024 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