title: How to move a symlink to the trash?
body: <p>I don't see any options for the <code>FSPathMoveObjectToTrashSync()</code> function for not following links.</p>
  
  <p>Here is what I have tried</p>
  
  <p>Create a link and a file</p>
  
  <pre><code>[ 21:32:41 /tmp ] $ touch my_file
  [ 21:32:45 /tmp ] $ ln -s my_file my_link
  [ 21:32:52 /tmp ] $ la
  total 8
  drwxrwxrwt   12 root     wheel   408 17 Maj 21:32 .
  drwxr-xr-x@   6 root     wheel   204  9 Sep  2009 ..
  -rw-r--r--    1 neoneye  wheel     0 17 Maj 21:32 my_file
  lrwxr-xr-x    1 neoneye  wheel     7 17 Maj 21:32 my_link -&gt; my_file
  </code></pre>
  
  <p>Move the link to the trash</p>
  
  <pre><code>OSStatus status = FSPathMoveObjectToTrashSync(
      "/tmp/my_link",
      NULL,
      kFSFileOperationDefaultOptions
  );
  NSLog(@"status: %i", (int)status);
  </code></pre>
  
  <p>Output is</p>
  
  <pre><code>status: 0
  </code></pre>
  
  <p>However the file got removed and not the link</p>
  
  <pre><code>[ 21:32:55 /tmp ] $ la
  total 8
  drwxrwxrwt   11 root     wheel   374 17 Maj 21:33 .
  drwxr-xr-x@   6 root     wheel   204  9 Sep  2009 ..
  lrwxr-xr-x    1 neoneye  wheel     7 17 Maj 21:32 my_link -&gt; my_file
  [ 21:33:05 /tmp ] $
  </code></pre>
  
  <p>How can I move move symlinks to the trash?</p>
  
  <hr>
  
  <p><strong>The Solution.. thanks to Rob Napier</strong></p>
  
  <pre><code>NSString* path = @"/tmp/my_link";
  OSStatus status = 0;
  
  FSRef ref;
  status = FSPathMakeRefWithOptions(
      (const UInt8 *)[path fileSystemRepresentation], 
      kFSPathMakeRefDoNotFollowLeafSymlink,
      &amp;ref, 
      NULL
  );  
  NSAssert((status == 0), @"failed to make FSRef");
  
  status = FSMoveObjectToTrashSync(
      &amp;ref,
      NULL,
      kFSFileOperationDefaultOptions
  );
  NSLog(@"status: %i", (int)status);
  </code></pre>