Hello experts,
maybe this question has been raised before, but I couldn´t find any specific postings. So I started this new topic, hoping you will be able to help me out of my misery.
What I am trying to do is create a little backup program for my most important folders. I want it to be flexible, so I would like to implement a choose folder dialog (only folders are involved). Here is what I have so far:
script DelOldBck
on DelOldBck()
set OldDefault to alias "Macintosh HD:Users:XXX:Desktop:"
set OldFolders to (choose folder with prompt "Choose Folders to delete:" default location OldDefault with multiple selections allowed)
tell application "Finder" to set theOLdFold to every folder of OldFolders as alias list
repeat with _folder in theOLdFold
delete _folder
end repeat
end DelOldBck
end script
tell DelOldBck to DelOldBck()
So basically I would like to select something which then gets passed on to another functionality, in this particular case the trash. But it might as well be a functionality to duplicate the selected folders to a different location instead of the trash. Or the bin, as you may call it…
I have done some research on POSIX, etc. and have already done some testing with different setups in this regard. Everything failed and threw an error, the above coding is the one that does not throw any errors, but doesn´t do anything either.
From what I have seen in the standard ScriptEditor, the selection is stored as an array of aliases, does that have anything to do with the problems that arise here? I am working with Catalina by the way.
Please share your knowledge on this one. If you have a solution I would also be interested why your code works. Thanks in advance!