It seems I¹m still having a problem with filename truncation and this is
using 2006r1.
I decided to go back to my simpler method of setting the folderitems,
because of Joe¹s advise to change to AbsolutePath throughout. So I¹m now
using:
sourcepath=TargetList.cell(i,1)//path to the source file
sourcerootpath=TargetList.cell(i,3)//path to root folder of the source
targetrootpath=TargetList.cell(i,2)//path to root folder of the target
//replace the source path with the target path to create the correct
complete Target path
targetpath=Replace(sourcepath,sourcerootpath,targetrootPath)
//get the FolderItems
f=GetTrueFolderItem(sourcePath)
g=GetTrueFolderItem(targetPath)
Instead of this:
f=new folderitem(sourcerootpath)
f=f.child(nthField(sourcepath,":",countfields(sourcepath,":")))
g=new folderitem(targetrootPath)
g=g.child(nthField(targetpath,":",countfields(targetpath,":")))
This actually seems to be working as expected but, of course, not quite.
It¹s gone back to truncating the copy¹s filenames.
Here¹s an example:
SourceRootPath: Firewire 400:Users:jeffrey:New Files:This is a test file it
has many characters - foobar foobar - test text 32 - 33.whatever.txt.rtf
SourcePath: Firewire 400:Users:jeffrey:New Files:This is a test file it has
many characters - foobar foobar - test text 32 - 33.whatever.txt.rtf
TargetRootPath: Firewire 400:Users:jeffrey:Desktop:New Files: his is a test
file it has many characters - foobar foobar - test text 32 -
33.whatever.txt.rtf
TargetPath: Firewire 400:Users:jeffrey:Desktop:New Files:This is a test file
it has many characters - foobar foobar - test text 32 - 33.whatever.txt.rtf
But here are the folderitems:
f: folderitem: Absolutepath: Firewire 400:Users:jeffrey:New Files:This is a
test file #159841.rtf
g: Folderitem: Absolutepath: Firewire 400:Users:jeffrey:Desktop:New
Files:This is a test file it has many
origin: folderitem: Absolutepath: Firewire 400:Users:jeffrey:New Files:This
is a test file #159841.rtf
destination: Folderitem: Absolutepath: Firewire
400:Users:jeffrey:Desktop:New Files:This is a test file it has many
However, the DisplayNames are still un-truncated (is that word?)
origin: folderitem: DisplayName: This is a test file it has many characters
- foobar foobar - test text 32 - 33.whatever.txt.rtf
destination: Folderitem: DisplayName: This is a test file it has many
characters - foobar foobar - test text 32 - 33.whatever.txt.rtf
Can someone please tell me A. How to correct this, B. What I¹m doing wrong
to cause it, or C. How to rename the file after the copy to workaround it?
Here¹s the code which does the Copying:
CopyFileOrFolder(source as folderitem, destination as folderitem)
Dim i as Integer
Dim newFolder as FolderItem
If source.directory then //it's a folder
newFolder=destination //.child(source.name) This was creating a
nilObject.
if destination.exists = false then
newFolder.createAsFolder
else
newFolder=destination.child(source.name)
newFolder.createAsFolder
end if
For i=1 to source.count //go through each item
If source.trueitem(i).directory then
//it's a folder
CopyFileOrFolder source.trueitem(i), newFolder
//recursively call this
//routine passing it the folder
else
source.trueitem(i).CopyFileTo newFolder //it's a file so copy it
end if
next
else //it's not a folder
source.CopyFileTo destination
end if
exception err as NilObjectException
msgbox "Some NilObject Error occurred."
End Sub
All My Best,
Jeffrey
_______________________________________________
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>