163 views

# Move or Delete prompts Windows Message

1. 2 months ago

### Alex M

Jun 12

When I use FolderItem.Remove or FolderItem.Delete on bulk file processes, sometimes Windows pops up a message that is not handled by XOJO.

The item <Filename> that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly.

Nearest match on based on size, date, and type: ...

Do you want to fix this shortcut to point to this target or do you just want to delete it?

It stops the XOJO program until the user selects an option, which is a problem because I want it to run unattended.

How do I prevent this window from popping up?

See post in context

Use FolderItem.TrueItem or FolderItem.TrueChild (instead of FolderItem.Item or FolderItem.Child) to get a FolderItem that points to the shortcut file itself rather that the shortcut target.

Dim root As FolderItem = GetFolderItem("C:\Foo\bar") ' parent of the file to delete

Dim item As FolderItem = root.TrueItem(0) ' first item in the directory
// OR
Dim item As FolderItem = root.TrueChild("filename.txt") ' get child by name

item.Delete()
2. ### Alex M

Jun 12

I should add this is my first posting in the XOJO forum. Thanks in advance for any assistance.

3. ### Andrew L

Jun 12 Answer San Francisco, CA, USA

Use FolderItem.TrueItem or FolderItem.TrueChild (instead of FolderItem.Item or FolderItem.Child) to get a FolderItem that points to the shortcut file itself rather that the shortcut target.

Dim root As FolderItem = GetFolderItem("C:\Foo\bar") ' parent of the file to delete

Dim item As FolderItem = root.TrueItem(0) ' first item in the directory
// OR
Dim item As FolderItem = root.TrueChild("filename.txt") ' get child by name

item.Delete()
4. ### Alex M

Jun 12

Andrew - I just looked up FolderItem.TrueItem.