Thanks Norm,

That's what I was after... I didn't realize you could alter the file name like that. I assumed a copy would copy the file intact including the file name. This is cool. I have it working doing a rename of the file to be copied, do the copy, then change it back. I didn't like that approach and simply changing the name in the copy statement is perfect!


Message: 2
Subject: Re: Renameing files on copy
From: Norman Palardy <[EMAIL PROTECTED]>
Date: Sat, 1 Jul 2006 12:28:53 -0600


On Jul 01, 2006, at 11:21 AM, Craig Hoyt wrote:

I searched the archives and didn't see anything on this. I need to
copy the contents of one folder into another. On the chance that a
file name might be the same I need to alter the name slightly to
make it unique to the destination folder. What is the proper (best)
way to do this. The only idea I have is alter the name of the
original file, copy, then change the name back to what it was.
While this is not a major issue to do this, I'm thinking their
might be a better way. Anybody?

See if the destination exists first and if it does alter the
destination name
A copy should not touch the originals file name

If you are using folderItem's CopyFileTo method then you need a
destination FolderItem anyways

        destFolder = <where ever you are copying to>

        destName = original.Name

        while destFolder.Child(destName).exists
                iteration = iteration + 1
                destName = original.Name + " " + format(iteration,"#")
        wend

        destination = destFolder.Child(destName)


        original.CopyFileTo destination                 

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to