Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > replace text in...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3260 of 3314
Post > Topic >>

replace text in FolderItem names recursively

by that one more kid <ozgunbey@[EMAIL PROTECTED] > Sep 11, 2007 at 12:59 AM

Hello,
I am trying to replace all occurence of oldtext within a specified
FolderItem's name and its subcontents' names. I wrote a sub to do this
in RB2007r1:

sub RenameFolder(folder as FolderItem, oldtext as string, newtext as
string)
  Dim i as Integer

  If folder.directory then
    folder.name=replaceAll(folder.name, oldtext, newtext)
    if folder.count > 0 then
      For i=1 to folder.count
        If folder.TrueItem(i).directory then
          RenameFolder folder.TrueItem(i), oldtext, newtext
        else
          folder.TrueItem(i).name=replaceAll(folder.TrueItem(i).name,
oldtext, newtext)
        end if
      next
    end if
  else
    folder.name=replaceAll(folder.name, oldtext, newtext)
  end if
end sub

But it sometimes works, sometimes does not. I think it's because the
item index numbers within a folder change when one of its' subcontents
is renamed. What can I do about it?

Thanks




 3 Posts in Topic:
replace text in FolderItem names recursively
that one more kid <ozg  2007-09-11 00:59:33 
Re: replace text in FolderItem names recursively
that one more kid <ozg  2007-09-11 07:16:56 
Re: replace text in FolderItem names recursively
Joe Strout <joe@[EMAIL  2007-09-11 09:03:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 4:13:16 CDT 2008.