Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bitinn opened this issue May 10, 2015 · 4 comments
Open

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

bitinn opened this issue May 10, 2015 · 4 comments

Comments

@bitinn
Copy link

bitinn commented May 10, 2015

"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?

@sindresorhus
Copy link
Owner

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.

@SamVerschueren
Copy link
Contributor

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

@SamVerschueren
Copy link
Contributor

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

@sindresorhus
Copy link
Owner

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

@sindresorhus sindresorhus reopened this Oct 15, 2015
Repository owner locked and limited conversation to collaborators Oct 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants