Hi. On the Mac I have a handler that can move a folder to the trash by using an AppleScript that I call with a shell command.
I have a custom property of the stack “Scripts" cDeleteMacFolderScript that contains a template script tell application "Finder" delete "**foldertodelete**" end tell Then I have the following handler on deletemacOSfolder folderMacpath put the cDeleteMacFolderScript of stack “Scripts" into thescript replace "**foldertodelete**" with folderMacpath in thescript do thescript as applescript end deletemacOSfolder It works a charm, run it and the folder ends up in the Trash Easy-peasy. I have been trying to do the same thing with Windows and not having any luck. First Challenge was finding the path to the recycle bin. Using SpecialfolderPath() to get the path for the Recycle Bin did not work. See the bug report here. https://quality.livecode.com/show_bug.cgi?id=22995 <https://quality.livecode.com/show_bug.cgi?id=22995> I did manage write a script using the Windows shell commands to get a path to the user’s Recycle Bin and then move a directory to it using the LiveCode rename command. The folder is actually moved to the user's Recycle Bin but when you Open the Recycle Bin in the Windows Explorer GUI you don’t see the folder. Here is the script I used. on mouseUp pButtonNumber answer folder "Select the folder to move to Recycle Bin folder." put it into tFoldertoRecycle if platform() is "win32" or platform() is "win64" then MoveFolderToRecycleBin tFolderToRecycle end if end mouseUp command MoveFolderToRecycleBin pFolderToMove put SpecialFolderPath_RecycleBinFolder() into tRecycleBinPath replace "/" with "\" in tRecycleBinPath set the itemDelimiter to "\" put the last item of pFolderToMove into tFolderName put tRecycleBinPath & "\" & tFolderName into tRecycleBinPath put pFolderToMove into line 1 of field 1 put tRecycleBinPath &Cr &CR into line 2 of field 1 rename folder pFolderToMove to tRecycleBinPath end MoveFolderToRecycleBin function SpecialFolderPath_RecycleBinFolder put shell ("whoami /user") into tUserInformation set the itemDelimiter to space put item 2 of line 7 of tUserInformation into tUserSID put "C:\$Recycle.Bin\" & tUserSID into tUserRecycleBinPath return tUserRecycleBinPath end SpecialFolderPath_RecycleBinFolder You can see that the folder was actually moved there by using the Windows Command Prompt program. If you type: C:\> cd \$Recycle.Bin C: \$Recycle.Bin> dir /s /a You will get a listing of the contents of the directory and the subdirectories including the one that contains the files in the logged in user’s recycle bin. - files or folders the user dragged there in the GUI are there (but their file names are not the same as their actual names) - folders I moved there using the script above are also there (their folder names are the same as they were in their original location). I have read a lot of posts and documentation on the Recycle Bin and know far more than I ever wanted to know about it but it seems that simply moving a file to the users directory for the user’s Recycle Bin does not actually put it in the “RecycleBin" as seen in the Windows Explorer GUI. I found a post that says that here. https://superuser.com/questions/1520290/how-to-access-another-windows-10-installations-recycle-bin-files-on-a-partition This folder (Recycle Bin) is a special folder, because if you double-click the folder within Explorer, it will open the Recycle Bin program, rather than show the contents of that folder. As a result, it will show you all files deleted in your current Windows Installation, and not what is actually inside that folder. I don’t see any other way of Recycling a folder, or a file for that matter using the shell short of buying and installing one of a couple of utility programs that popped up in some of my searches. I can’t expect users to do that. I know you can delete a folder and its contents using the revDeleteFolder Command. This removes the folder and files instantly. I was hoping there was a way to just move them the Recycle Bin but it does not appear to be possible from shell. However the fact that there are utilities that do it mean there must be some way programmatically. Does anyone know of a way to accomplish this? Thanks Martin Koob VideoLinkwell _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode