>
>> If you're comfortable with UNIX, why not just do this???
>>
>> dim s as new shell
>> s.execute "mv "+source.shellpath+" "+dest.shellpath
>
> Because it also has to work on Windows.
>
> And besides, it seems like it *ought* to work. And I'd like to
> understand this. FolderItems are kind of important...
The SHELL example I provided will work fine on Windows too.
But, if you want to understand.
RB brings the item/container metaphor from the Finder/Explorer to
programming.
Working with folderitems in RB is like performing a programatically
drag and drop, you need to work within the metaphor rules.
I'll use the desktop folder as a base for a short example, which
creates a folder on your desktop, creates a file inside it, then
moves that file out of the newly created folder onto the desktop
dim folder, file as folderitem
dim output as TextOutputStream
folder = DesktopFolder.child("Destination Folder")
//if it doesn't exist, create it
if not folder.exists then f.createAsFolder
//if it does exists, make sure that it is a container (folder or
directory)
if not folder.directory then
msgbox "error - cannot create an item inside an item"
else //it exists and it's a folder
file = folder.child("New File")
if not file.exists then output = file.createTextFile
output.write "file contents.txt"
output.close
file.moveFileTo DesktopFolder
end
- Tom
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>