Skip to content

Add delete file functionality for Android side#47

Open
yubingjiaocn wants to merge 1 commit into
T0biasCZe:masterfrom
yubingjiaocn:master
Open

Add delete file functionality for Android side#47
yubingjiaocn wants to merge 1 commit into
T0biasCZe:masterfrom
yubingjiaocn:master

Conversation

@yubingjiaocn

Copy link
Copy Markdown
Contributor

Summary

This PR implements file deletion functionality for the Android file browser, addressing issue #17.

Features

  • Delete key triggers deletion of selected files/folders (Windows Explorer-like behavior)
  • Right-click context menu with Delete option
  • Confirmation dialog before deletion, warning that Android has no recycle bin (permanent deletion)
  • Support for deleting multiple files/folders at once
  • Error handling with detailed messages for permission denied, file not found, read-only filesystem, etc.
  • Auto-refresh file list after deletion

Implementation Details

Files modified:

  • Form1.cs: Added deleteSelectedFiles() method and Delete key handler in dataGridView1_KeyDown()
  • Form1.Designer.cs: Added context menu (contextMenu_android) with Delete menu item
  • Localization/strings.resx and strings.Designer.cs: Added localization strings for confirmation dialogs and error messages

ADB commands used:

  • Files: adb shell rm "{path}"
  • Directories: adb shell rm -rf "{path}"

Test Plan

  • Delete single file with Delete key
  • Delete single folder with Delete key
  • Delete multiple files/folders
  • Cancel deletion with "No" button
  • Verify file list refreshes after deletion
  • Right-click context menu Delete option

Tested on Windows 11 + Xiaomi 14 (Android 16).

Fixes #17

Implements file deletion on Android device via ADB with Windows Explorer-like behavior:
- Delete key triggers deletion of selected files/folders
- Right-click context menu with Delete option
- Confirmation dialog warning about permanent deletion (no recycle bin)
- Uses adb shell rm for files and rm -rf for directories
- Error handling for permission denied, file not found, etc.
- Auto-refresh file list after deletion

Fixes T0biasCZe#17

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Not properly deleting files or folders

1 participant