![]() ![]() Or, using the SpecialFolder module: destination = SpecialFolder.Desktop 'the user's desktop directory Depending on the destination, you can use one of several methods to acquire the destination FolderItem.įor example, Dim destination As FolderItemĭestination = GetFolderItem("C:\DestinationExample\", PathTypeAbsolute) To copy or move a file to another directory, you need to acquire a FolderItem representing the destination directory. Once you've constructed the FolderItem you can modify its properties and call its methods to affect changes to the underlying file or directory. SourceFile = GetFolderItem("C:\ExampleFolder\ExampleFile.txt", PathTypeAbsolute) To create a FolderItem instance for a particular absolute path, pass the path to the GetFolderItem method and store the result: Dim SourceFile As FolderItem The FolderItem class can represent any file or folder on the machine. ![]() If you want video training, subscribers can get over 40 hours of Real Studio and Xojo training at ![]() There are many examples of how to use GetFolderItem at Folderitem child and parent methods are very important to learn. SpecialFolder.ApplicationData returns a folderitem and child looks for the file. If your files was in the Application Data folder you would access it: dim f as folderitem = ("somefile.pdf") There are some proscribed locations that are meant to be accessed a lot (Application Data, Preferences, etc) and the easiest way to get to them is use the SpecialFolders object. If the file is somewhere else you can use the Absolute Path like "C:/SomeFolder/somefile.pdf". This basic function looks for the pdf file in the same directory as the executable. Generally the folderitem class is initialized by using the GetFolderItem method: dim f as folderitem = GetFolderItem("somefile.pdf") The FolderItem class has a built-in FileCopy method and I'd recommend learn FolderItem because it makes file handling so much easier in the long run because it's really the only way to do it in Xojo/Real Studio. ![]()
0 Comments
Leave a Reply. |