sindresorhus/trash

Trash multiple files won't get `put back` options on OS X

bitinn opened this issue · 4 comments

"cron1": "find ./cache/ -maxdepth 1 -type f -mtime +1d -not -name .gitignore -exec trash {} +"
"cron2": "find ./cache/ -maxdepth 1 -type f -mtime +1d -not -name .gitignore -exec trash {} \\;"

cron1 does not appear to allow put back in trash.

The only difference appear to be cron1 pass all files to trash at once, cron2 pass and run trash 1 by 1. I might be doing something wrong, but unable to spot it.

PS: since trash is silent, do you see anyway I can make this command verbose? so I can do a simple | wc -l at the end to count files?

The only difference appear to be cron1 pass all files to trash at once, cron2 pass and run trash 1 by 1. I might be doing something wrong, but unable to spot it.

Hmm, I can reproduce too. Weird. I'll look into it.

PS: since trash is silent, do you see anyway I can make this command verbose? so I can do a simple | wc -l at the end to count files?

Count the files before passing them into trash. Not interested in a verbose mode.

I tried to track down this bug but what I discover here is really weird. When running the tests, all the files created and trashed by the tests are able to put back. So at first, I thought this was an issue with something in the CLI, it seemed the code did it right.

But when I run this small piece of code

fs.writeFileSync('fixture', '');

trash(['fixture', 'hello.txt']);

Where hello.txt is a file I created manually.

The fixture file has the ability to put back, but the manually created hello.txt file is not. Any ideas :)?

screen shot 2015-10-07 at 20 56 22
screen shot 2015-10-07 at 20 56 12

Oh, and if I add an extension to fixture (e.g. fixture.txt), the put back option disappears.

@SamVerschueren The issue is that only the first file sent the trash has Put back. Let's continue this in sindresorhus/macos-trash#4.