[code]Dim sourceFile As FolderItem = SpecialFolder.Documents.Child(“MyFile.txt”)
If sourceFile.Exists Then
Dim destFile As FolderItem = SpecialFolder.ApplicationSupport.Child(sourceFile.Name)
sourceFile.MoveTo(destFile)
End If[/code]
Just to be sure and to make it right let you me add code to check the dest file for existence. Especially when you rename, copy, move or make backup of files you temporary access. You never know it if there’s not already a destination.
The new framework FolderItem raises an exception. The old one “only” reported it to .LastErrorCode. So you’re app will most likely crash.
if not destfile.exists then
sourceFile.MoveTo(destFile)
else
// err
end if
[quote=253904:@Sascha S]Dim sourceFile As FolderItem = SpecialFolder.Documents.Child(“MyFile.txt”)
If sourceFile.Exists Then
Dim destFile As FolderItem = SpecialFolder.ApplicationSupport.Child(sourceFile.Name)
sourceFile.MoveTo(destFile)
End If[/quote]
Well explained!, but what If the SourceFile name is variable. I tried
Dim sourceFile As FolderItem = SpecialFolder.Desktop.Child("DescargaMultiple").item(0)
I need to discard Invisible files, like .DS_Store(Mac) or thumb(Windows)[/quote]
Yes, Analizing FolderItem.Visible = True and the last three characters of the Filename (Extension)
On macOS, some files are not displayed by the Finder, but their name do not start with a dot, and are not declared as invisibles. I forgot the name(s).
.DS_STore does not have extensions (still MacOS), some other system files does not have too (still forget who).