Page 1 of 1
Can't delete files in certain situation, but preview works

Posted:
Thu May 20, 2010 2:54 pm
by HerbDavisY2K
I'm creating symbolic links (via an applescript) from folderA to folderB and what I am trying to do is remove missing symbolic links from folder B after I delete the original in folderA.
I created a rule that says:
"if kind is not folder then delete", When I preview this rule all, it looks correct. The symbolic links that no longer have an original in folderA "pass" the rule. However, when I run the rule on folderB nothing happens. Any suggestions?
Re: Can't delete files in certain situation, but preview works

Posted:
Fri May 21, 2010 3:20 pm
by HerbDavisY2K
I got this working by running this applescript rule on folderB (the one that contains all the symlinks)
This works with there are multiple symlinks that are missing their originals in folderA
- Code: Select all
set SourceFolder to POSIX path of theFile
set myFind to do shell script "find -L " & quoted form of SourceFolder & " " & "-type l"
repeat with matchpath in paragraphs of myFind
set myfiles to quoted form of matchpath
try
do shell script "rm " & myfiles
end try
end repeat
Re: Can't delete files in certain situation, but preview works

Posted:
Fri May 21, 2010 4:29 pm
by Mr_Noodle
Note that symbolic links are different than the things they point to. While you can navigate to it like a folder in Finder and in other places, they are different types of entities. Hazel treats links as links and not as the thing they point to.
Re: Can't delete files in certain situation, but preview works

Posted:
Fri May 21, 2010 6:12 pm
by HerbDavisY2K
Good to know. I'm using symbolic links because when using XBMC, alias files aren't treated like regular folders while symbolic links are.
Re: Can't delete files in certain situation, but preview wor

Posted:
Thu Jan 05, 2012 11:00 am
by gcoghill
Do you mind sharing you AppleScript for symbolic links? I want to create them for current work folders, and then move the symlinks to Dropbox. Idea is to automate it so just the folders that have been modified recently get the symlinks, and the inactive ones are deleted from Dropbox.
Thanks!