Hi All

I am using FSO to manage Folders and files.
Set fso = CreateObject("Scripting.FileSystemObject")
strRet = fso.MoveFolder (cstr(strSource),cstr(strDestination))
Set fso = Nothing

As there is no rename option in FSO so I have to use MoveFolder () to rename
a folder.

It renaming the folder if folder do not have any containing (child) folder,
if there is any folder inside to that folder it gives error "permission
denied"
Any suggestion ?


Regards

Fayyaz

Re: Rename a Folder by Ray

Ray
Tue Apr 13 08:39:48 CDT 2004

Set the name property. It's read/write.

Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(strSource)
oFolder.Name = CStr(strDestination)
Set oFolder = Nothing
Set fso = Nothing

Ray at work




"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:eyDGhuVIEHA.3440@TK2MSFTNGP09.phx.gbl...
> Hi All
>
> I am using FSO to manage Folders and files.
> Set fso = CreateObject("Scripting.FileSystemObject")
> strRet = fso.MoveFolder (cstr(strSource),cstr(strDestination))
> Set fso = Nothing
>
> As there is no rename option in FSO so I have to use MoveFolder () to
rename
> a folder.
>
> It renaming the folder if folder do not have any containing (child)
folder,
> if there is any folder inside to that folder it gives error "permission
> denied"
> Any suggestion ?
>
>
> Regards
>
> Fayyaz
>
>



Re: Rename a Folder by F

F
Tue Apr 13 08:49:24 CDT 2004

I tried this and giving me this Error.

Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument at line below.

oFolder.Name = CStr(strDestination)

Regards
Fayyaz

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OV$gLzVIEHA.2252@TK2MSFTNGP10.phx.gbl...
> Set the name property. It's read/write.
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set oFolder = fso.GetFolder(strSource)
> oFolder.Name = CStr(strDestination)
> Set oFolder = Nothing
> Set fso = Nothing
>
> Ray at work
>
>
>
>
> "F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
> news:eyDGhuVIEHA.3440@TK2MSFTNGP09.phx.gbl...
> > Hi All
> >
> > I am using FSO to manage Folders and files.
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > strRet = fso.MoveFolder (cstr(strSource),cstr(strDestination))
> > Set fso = Nothing
> >
> > As there is no rename option in FSO so I have to use MoveFolder () to
> rename
> > a folder.
> >
> > It renaming the folder if folder do not have any containing (child)
> folder,
> > if there is any folder inside to that folder it gives error "permission
> > denied"
> > Any suggestion ?
> >
> >
> > Regards
> >
> > Fayyaz
> >
> >
>
>



Re: Rename a Folder by Ray

Ray
Tue Apr 13 08:58:59 CDT 2004

What's the value of strDestination?

What does your whole code snippet look like?

As long as strSource and strDestination are valid, the code should be okay
(barring external factors like NTFS permissions and what not).

Ray at work

"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:uSAR13VIEHA.3896@TK2MSFTNGP11.phx.gbl...
> I tried this and giving me this Error.
>
> Microsoft VBScript runtime (0x800A0005)
> Invalid procedure call or argument at line below.
>
> oFolder.Name = CStr(strDestination)
>
> Regards
> Fayyaz
>
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:OV$gLzVIEHA.2252@TK2MSFTNGP10.phx.gbl...
> > Set the name property. It's read/write.
> >
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set oFolder = fso.GetFolder(strSource)
> > oFolder.Name = CStr(strDestination)
> > Set oFolder = Nothing
> > Set fso = Nothing
> >
> > Ray at work
> >
> >
> >
> >
> > "F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
> > news:eyDGhuVIEHA.3440@TK2MSFTNGP09.phx.gbl...
> > > Hi All
> > >
> > > I am using FSO to manage Folders and files.
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > strRet = fso.MoveFolder (cstr(strSource),cstr(strDestination))
> > > Set fso = Nothing
> > >
> > > As there is no rename option in FSO so I have to use MoveFolder () to
> > rename
> > > a folder.
> > >
> > > It renaming the folder if folder do not have any containing (child)
> > folder,
> > > if there is any folder inside to that folder it gives error
"permission
> > > denied"
> > > Any suggestion ?
> > >
> > >
> > > Regards
> > >
> > > Fayyaz
> > >
> > >
> >
> >
>
>



Re: Rename a Folder by F

F
Tue Apr 13 10:15:41 CDT 2004

Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(CStr("c:\test"))
MsgBox oFolder.Name
oFolder.Name = ("c:\test1")
Set oFolder = Nothing
Set fso = Nothing


I tried this above code in VB and its giving me the same error.

Regards


"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:eyDGhuVIEHA.3440@TK2MSFTNGP09.phx.gbl...
> Hi All
>
> I am using FSO to manage Folders and files.
> Set fso = CreateObject("Scripting.FileSystemObject")
> strRet = fso.MoveFolder (cstr(strSource),cstr(strDestination))
> Set fso = Nothing
>
> As there is no rename option in FSO so I have to use MoveFolder () to
rename
> a folder.
>
> It renaming the folder if folder do not have any containing (child)
folder,
> if there is any folder inside to that folder it gives error "permission
> denied"
> Any suggestion ?
>
>
> Regards
>
> Fayyaz
>
>



Re: Rename a Folder by Ray

Ray
Tue Apr 13 10:29:17 CDT 2004

You don't have to CStr a string. It's already a string.

You're trying to name the folder C:\test1. The name of the folder should be
test1, not the full path. Try this slightly modified snippet.

Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder("c:\test")
MsgBox oFolder.Name
oFolder.Name = "test1"
Set oFolder = Nothing
Set fso = Nothing

Ray at work



"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:eodzAoWIEHA.2300@tk2msftngp13.phx.gbl...
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set oFolder = fso.GetFolder(CStr("c:\test"))
> MsgBox oFolder.Name
> oFolder.Name = ("c:\test1")
> Set oFolder = Nothing
> Set fso = Nothing
>
>
> I tried this above code in VB and its giving me the same error.
>
> Regards
>



Re: Rename a Folder by F

F
Tue Apr 13 11:30:36 CDT 2004

Thanks Ray

Its working.
I was giving full path that was wrong.

Regards
Fayyaz


"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OH2MWwWIEHA.2524@TK2MSFTNGP11.phx.gbl...
> You don't have to CStr a string. It's already a string.
>
> You're trying to name the folder C:\test1. The name of the folder should
be
> test1, not the full path. Try this slightly modified snippet.
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set oFolder = fso.GetFolder("c:\test")
> MsgBox oFolder.Name
> oFolder.Name = "test1"
> Set oFolder = Nothing
> Set fso = Nothing
>
> Ray at work
>
>
>
> "F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
> news:eodzAoWIEHA.2300@tk2msftngp13.phx.gbl...
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set oFolder = fso.GetFolder(CStr("c:\test"))
> > MsgBox oFolder.Name
> > oFolder.Name = ("c:\test1")
> > Set oFolder = Nothing
> > Set fso = Nothing
> >
> >
> > I tried this above code in VB and its giving me the same error.
> >
> > Regards
> >
>
>



Re: Rename a Folder by F

F
Tue Apr 13 11:36:09 CDT 2004

But Main Problem is still there.

If any folder contain any child folder its giving error "Permission Denied"

otherthan that its OK




"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OH2MWwWIEHA.2524@TK2MSFTNGP11.phx.gbl...
> You don't have to CStr a string. It's already a string.
>
> You're trying to name the folder C:\test1. The name of the folder should
be
> test1, not the full path. Try this slightly modified snippet.
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set oFolder = fso.GetFolder("c:\test")
> MsgBox oFolder.Name
> oFolder.Name = "test1"
> Set oFolder = Nothing
> Set fso = Nothing
>
> Ray at work
>
>
>
> "F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
> news:eodzAoWIEHA.2300@tk2msftngp13.phx.gbl...
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set oFolder = fso.GetFolder(CStr("c:\test"))
> > MsgBox oFolder.Name
> > oFolder.Name = ("c:\test1")
> > Set oFolder = Nothing
> > Set fso = Nothing
> >
> >
> > I tried this above code in VB and its giving me the same error.
> >
> > Regards
> >
>
>



Re: Rename a Folder by Ray

Ray
Tue Apr 13 11:49:56 CDT 2004

You probably have a file open in the folder or one of the subfolders.

Ray at work

"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:urCJ9UXIEHA.3988@tk2msftngp13.phx.gbl...
> But Main Problem is still there.
>
> If any folder contain any child folder its giving error "Permission
Denied"
>
> otherthan that its OK
>
>
>
>
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:OH2MWwWIEHA.2524@TK2MSFTNGP11.phx.gbl...
> > You don't have to CStr a string. It's already a string.
> >
> > You're trying to name the folder C:\test1. The name of the folder
should
> be
> > test1, not the full path. Try this slightly modified snippet.
> >
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set oFolder = fso.GetFolder("c:\test")
> > MsgBox oFolder.Name
> > oFolder.Name = "test1"
> > Set oFolder = Nothing
> > Set fso = Nothing
> >
> > Ray at work
> >
> >
> >
> > "F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
> > news:eodzAoWIEHA.2300@tk2msftngp13.phx.gbl...
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set oFolder = fso.GetFolder(CStr("c:\test"))
> > > MsgBox oFolder.Name
> > > oFolder.Name = ("c:\test1")
> > > Set oFolder = Nothing
> > > Set fso = Nothing
> > >
> > >
> > > I tried this above code in VB and its giving me the same error.
> > >
> > > Regards
> > >
> >
> >
>
>



Re: Rename a Folder by Grumpy

Grumpy
Fri Jan 07 08:12:19 CST 2005


Ray at wrote:
> YOU PROBABLY HAVE A FILE OPEN IN THE FOLDER OR ONE OF THE SUBFOLDERS
>
>

If you are renaming a folder, IUSR has to have permissions not just fo
the folder you are renaming, but for its parent folder too.

...I wish I'd realized this an hour ago!

Grumpy Mar


-
Grumpy Mar
-----------------------------------------------------------------------
Posted via http://www.webservertalk.co
-----------------------------------------------------------------------
View this thread: http://www.webservertalk.com/message179530.htm