recycle-bin

Trash files inside user-selected folder inside iCloud Drive

混江龙づ霸主 提交于 2020-12-09 04:24:11
问题 My app works with user txt-files (create, change, delete) inside any user-selected folder. I just internally store the bookmark to get access to that user-selected folder and files. Now, with macOS Catalina when the source folder is inside iCloud Drive, system still allows me to create and edit files. But doesn't allow to trash one. When I try to do it via [[NSFileManager defaultManager] trashItemAtURL: ... ] I get the following error: Error Domain=NSCocoaErrorDomain Code=3328 "<filename>

Trash files inside user-selected folder inside iCloud Drive

坚强是说给别人听的谎言 提交于 2020-12-09 04:23:57
问题 My app works with user txt-files (create, change, delete) inside any user-selected folder. I just internally store the bookmark to get access to that user-selected folder and files. Now, with macOS Catalina when the source folder is inside iCloud Drive, system still allows me to create and edit files. But doesn't allow to trash one. When I try to do it via [[NSFileManager defaultManager] trashItemAtURL: ... ] I get the following error: Error Domain=NSCocoaErrorDomain Code=3328 "<filename>

How can I delete files from recycle bin in windows? python

懵懂的女人 提交于 2020-05-13 17:58:29
问题 I'm trying to delete files that are in the recycle bin by using python, but i can't find a way to do it. Thanks. 回答1: For the Windows OS you can use the winshell module and it's empty method. Emptying the recycle bin is as easy as: import winshell winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=False) See some examples here. 回答2: There's a Windows shell module wrapped by PyWin32 that does this, assuming the question is for Windows. http://timgolden.me.uk/pywin32-docs

Deleting contents of W2K3 recycle bin

耗尽温柔 提交于 2020-01-25 22:52:51
问题 Writing a Powershell script that deletes all the contents from the recycle bins for virtual servers. For some reason I'm running into an error with finding the path for the Windows 2003 recycle bin and can't locate bin in order to delete everything in it. Was wondering if anyone here could give me some advice on what I am doing wrong with this code-snippet: if($serverVersion.name -like '*2003*'){ $dir = "\\$server" + '\C$\recycled' } elseif($serverVersion.name -like '*2008*'){ $dir = "\\

Properly move an object to the Trash

a 夏天 提交于 2020-01-11 08:42:42
问题 It looks like on Cocoa there are many ways to move file/folder-directory to Trash: [[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation] [[NSWorkspace sharedWorkspace] recycleURLs:] [NSFileManager trashItemAtURL:] [NSFileManager removeItemAtPath:] [NSFileManager removeItemAtURL:] It would be nice to understand what the difference is by either reading an explanation here or a link to the official Apple docs. Also if someone knows a universal way of moving a file/non

Override file delete in android

无人久伴 提交于 2020-01-04 09:17:51
问题 Is it possible to override File.delete() function? Whenever i delete any file from sdcard from other apps (not using by my application) i need a notification like this file is going to be delete. A sample code snippet i tried is, public class ExtendFile extends File { public ExtendFile(File dir, String name) { super(dir, name); // TODO Auto-generated constructor stub } @Override public boolean delete() { System.out.println("to be deleted"); return super.delete(); } } and File file = new File(

How to move a symlink to the trash?

我的梦境 提交于 2019-12-30 22:54:21
问题 I don't see any options for the FSPathMoveObjectToTrashSync() function for not following links. Here is what I have tried Create a link and a file [ 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 -> my_file Move the link to the trash OSStatus status =

How to move files and folders to Trash programmatically on macOS?

那年仲夏 提交于 2019-12-23 17:17:40
问题 All I can find on this topic is mentions of FSMoveObjectToTrashSync function, which is now deprecated and no alternative is listed for it. How to do it from C or Objective-C code? 回答1: Use NSFileManager: https://developer.apple.com/documentation/foundation/nsfilemanager trashItemAtURL:resultingItemURL:error: Moves an item to the trash. 回答2: In C, you can use AppleScript to move files to the trash. Here's a simple example: #include <stdio.h> #include <stdlib.h> #define PATH "/tmp/" #define

How to detect the item restore on a ItemAdded() event on SharePoint

霸气de小男生 提交于 2019-12-23 16:00:28
问题 I know that when an item is restored from the recycle bin, the ItemAdded event is fired. However, how can I detect if the item added comes from the recycle bin or if it is a new file. 回答1: This is a very old thread, but it comes up in the top results for searches on the topic. From my experiments with SP2010, it looks like properties.AfterProperties is empty when the item is coming from the Recycle Bin, whereas it is fully populated on an actual new item. So, a simple block such as this would

How can I get the localized name of a 'special' windows folder (Recycle bin etc.)?

混江龙づ霸主 提交于 2019-12-23 15:48:12
问题 I'm trying to find out the 'correct' windows API for finding out the localized name of 'special' folders, specifically the Recycle Bin. I want to be able to prompt the user with a suitably localized dialog box asking them if they want to send files to the recycle bin or delete them directly. I've found lots on the internet (and on Stackoverflow) about how to do the actual deletion, and it seems simple enough, I just really want to be able to have the text localized. 回答1: Read this article for