• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Move a file to the Trash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Move a file to the Trash


  • Subject: Move a file to the Trash
  • From: Lorenzo Puleo <email@hidden>
  • Date: Wed, 06 Nov 2002 11:08:32 +0100

Hi,
is someone that can suggest me how to move a file to the trash properly?
Actually I use the APIs:

NSString *fileInTrash = [[NSHomeDirectory()
stringByAppendingPathComponent:@".Trash"]
stringByAppendingPathComponent:[myFile lastPathComponent]];

ok = [manager movePath:myFile toPath:fileInTrash handler:nil];


This guarantees that the file goes to the current user's trash. But this
works properly only if the file is placed on the X boot disk.
Instead, when I tried to trash a file placed on a disk that is NOT my boot
disk, that file has not been simply "moved" but "copied" to the trash in the
boot disk then deleted from the original disk. This could require a waste of
time.

Since my eternal disks have the invisible folder "Trash" placed in the root,
I thought that I should move any external file to:
/Volumes/ExternalDisk/Trash/myFile
But I am not sure this is the solution.

How to do this properly? Carbon API "FindFolder"?
Thanks for any asnwer, sample code for Cocoa, links to PDF files, tricks...

--
Lorenzo Puleo
mailto:email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Move a file to the Trash
      • From: Nathan Day <email@hidden>
  • Prev by Date: Re: drawing with transparency
  • Next by Date: How to encode STL vector
  • Previous by thread: netinfod - rpc: timed out problem
  • Next by thread: Re: Move a file to the Trash
  • Index(es):
    • Date
    • Thread