sindresorhus / trash

Move files and directories to the trash
MIT License
2.58k stars 79 forks source link

Add glob support #38

Closed sindresorhus closed 9 years ago

sindresorhus commented 9 years ago

Using globby.sync().

PR welcome :)

sotojuan commented 9 years ago

I'll give this a shot this weekend. Doesn't seem so bad!

sotojuan commented 9 years ago

Question: Should the glob support be automatic or should the user supply an option? I got it working, but it doesn't match 'weird\\\\name\\"\'' because of the /s. It makes globby think it's a directory listing. Since it doesn't find one, it doesn't delete the file.

sotojuan commented 9 years ago

Sorry if you're busy Sindre, but let me know what you think of this ~_~ The "weird name" test is the only issue, assuming automatic globbing.

sindresorhus commented 9 years ago

Yes, should be just automatic. To fix the mentioned problem we should set nonull: true in globby.

https://github.com/isaacs/node-glob#comparisons-to-other-fnmatchglob-implementations

sotojuan commented 9 years ago

Thanks. Expect a PR soon!

kevva commented 9 years ago

Fixed in https://github.com/sindresorhus/trash/commit/ccd8d52d14f4f4b930e494d3909ffe26cb6fe1cb.