Deleting a file with "ctrl+d" is not working on Windows11
Describe the bug I use "ctrl+n" to create a new file in SPF. Then I use "ctrl+d" to delete the newly created file. But I can still see the file in SPF. I can also see the file in Windows file explorer.
System information (please complete the following information):
- OS: [Windows11]
- Version [22631.4169]
- Superfile Version [v1.1.4]
Yes. I met the same bug on win 11.
duplicate of #335
If you are using powershell can you check if there is any powershell hotkey conflict with ctrl+d?
@yorukot
I use powershell inside "Terminal Windows Version : 1.21.3231.0"
It is the same behavior with cmd.exe inside "Terminal Windows"
I don t have any ctrl-d hotkey configured. It print ^D
(I put a screenshot in case you see something I don't see)
I also tested cmd.exe and WindowsPowerShell\v1.0\powershell.exe in the default windows console, nothing bind on ctrl-d :
I have the same behavior : ctrl-d display the confirm dialog, the process show the deleted file, but does not delete file.
I have an occurence of this bug in a different way . Delete doesn't succeeds, and process is stuck at 0%
But sure enough, delete of either files or directories is not working in Windows, and needs to be fixed.
This is due to some issue in the trash library used https://github.com/rkoesters/xdg
Delete fails with this
2025/01/24 16:25:57 Paste item function move file to trash can error
2025/01/24 16:25:57 open C:\Users\nitin\.local\share\Trash\info\1.txt.trashinfo: The system cannot find the path specified.
Also this package has will move files to .local\share\Trash , and not the actual recycle bin of windows.
This can be a little bit confusing for windows users as the files they delete via Window explore goes to Recycle bin, but files deleted via superfile will go to some unknown location.
So, I am thinking of using this package for Windows - https://github.com/hymkor/trash-go For windows compatibility, the only other package I found was https://github.com/trubitsyn/go-recyclebin, but this is old and not maintained.
I have done a basic test of this.
package main
import (
"fmt"
"os"
"github.com/hymkor/trash-go"
)
func main() {
if len(os.Args) >= 2 {
// Move files to the trash
err := trash.Throw(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, "Error:", err)
os.Exit(1)
} else {
fmt.Println("Files moved to Recycle Bin successfully.")
}
} else {
fmt.Println("No files specified.")
}
}
Initial stage of bin
Sample code
Afterwards
@yorukot Are you okay with using this library for Windows Delete function, or is there something other thing we should try first ?
If thats okay, I can start with the implementation and testing.
@lazysegtree yes i am ok with that
@wxutopia @Zim-Inn @Hettomei Thanks for the bug report. This has been fixed. Can you do a local build spf from the main branch and see if the issue if fixed for you ?
Closing this. Please feel free to reopen if you still face the issue.