Hi--
Again, thank you for the detail in taking me through this. I really
appreciate it!
Ok, so here's my first question. If I replace your default locations with
SelectFolder, can I get two different folders into their correct variables,
or will one supercede the other?
Here's my thought:
sourceFolder = SelectFolder()
if sourceFolder = nil then return
sourceCount = sourceFolder.Count
targetFolder = SelectFolder()
if targetFolder = nil then return
targetCount = targetFolder.Count
Would this work for the next set of instructions? If not, can a number be
assigned to these commands, such as:
sourceFolder = SelectFolder(1)
if sourceFolder = nil then return
sourceCount = sourceFolder.Count
targetFolder = SelectFolder(2)
if targetFolder = nil then return
targetCount = targetFolder.Count
Or are the () only to signify a Function?
All My Best,
Jeffrey
Ok. This does seem to work, so now, I'm trying to add the recursion.
This is the code I found on the web, and it's been working quite well --
with this test as the exception of course.
// Select Root Folder
rootFolder = SelectFolder()
if rootFolder = nil then return
// Add rootFolder to stack
folders.Append rootFolder
// For each folder in the stack
while UBound(Folders) > -1
// Get the folder at the top of the stack
currentFolder = folders.Pop
// For each item in the current folder
for index = currentFolder.Count DownTo 1
itemInFolder = currentFolder.Item(index)
if itemInFolder <> nil then
// If item is a folder
if itemInFolder.Directory = true then
// Add folder to the stack
folders.Append itemInFolder
else
// Add file to the listbox
SourceList.AddRow itemInFolder.Name
SourceList.Cell(SourceList.LastIndex,1)=itemInFolder.Absolutepath
end if
end if
next
wend
So could I then combine your technique with this, such as:
sourceFolder = SelectFolder()
if sourceFolder = nil then return
sourceCount = sourceFolder.Count
// Add sourceFolder to stack
folders.Append sourceFolder
// For each folder in the stack
while UBound(Folders) > -1
// Get the folder at the top of the stack
currentFolder = folders.Pop
// For each item in the current folder
for index = currentFolder.Count DownTo 1
itemInFolder = currentFolder.Item(index)
if itemInFolder <> nil then
// If item is a folder
if itemInFolder.Directory = true then
// Add folder to the stack
folders.Append itemInFolder
else
// Add file to the listbox
sourceName = sourceFolder.Item(index).Name
sourcePath = sourceFolder.Item(index).AbsolutePath
SourceList.AddRow itemInFolder.Name
sourceDict.Value(sourceName) = sourcePath
SourceList.Cell(SourceList.LastIndex,1)=itemInFolder.Absolutepath
end if
end if
next
wend
staticText2.text=cstr(SourceList.Listcount)
Or will this work in basic principle. In practice, when I try this I get a
nilobject at the line:
sourceName = sourceFolder.Item(index).Name
So, obviously, I'm not following the logic somewhere...
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>