diff --git a/internal/files/trash.go b/internal/files/trash.go index 1cea4e5..31078f2 100644 --- a/internal/files/trash.go +++ b/internal/files/trash.go @@ -236,14 +236,15 @@ func TrashFile(trashDir, name string) error { return nil } -func TrashFiles(trashDir string, files ...string) (trashed int, err error) { +func TrashFiles(trashDir string, files ...string) (trashed int) { for _, file := range files { - if err = TrashFile(trashDir, file); err != nil { - return trashed, err + if err := TrashFile(trashDir, file); err != nil { + log.Errorf("error trashing file %s: %s", file, err) + continue } trashed++ } - return trashed, err + return trashed } func ConfirmTrash(confirm bool, fs Files, trashDir string) error { @@ -254,10 +255,8 @@ func ConfirmTrash(confirm bool, fs Files, trashDir string) error { tfs = append(tfs, file.Path()) } - trashed, err := TrashFiles(trashDir, tfs...) - if err != nil { - return err - } + trashed := TrashFiles(trashDir, tfs...) + var files string if trashed == 1 { files = "file" diff --git a/main.go b/main.go index 25412f4..6f85964 100644 --- a/main.go +++ b/main.go @@ -164,7 +164,8 @@ var ( for _, arg := range ctx.Args().Slice() { file, e := files.NewDisk(arg) if e != nil { - log.Fatalf("cannot trash '%s': No such file or directory", arg) + log.Errorf("cannot trash '%s': No such file or directory", arg) + continue } filesToTrash = append(filesToTrash, file) }