Home
Forums
New posts
Search forums
What's new
New posts
New resources
New profile posts
Latest activity
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
DMCA Policy
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
FEEL FREE TO SHARE TUTORIALS, YOUR SKILS & KNOWLEDGE ON CODING, SCRIPTS, THEMES, PLUGINS OR ANY RESOURCES YOU HAVE WITH THE COMMUNITY-
Click Here To Post Your Request,
JOIN COMPUTER REPAIR FORUM
Home
Forums
TUTORIALS
CODING TUTORIALS
Node.js
Command Line trash
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="codeguru" data-source="post: 70" data-attributes="member: 2"><p>One of the first commands you learn when experimenting with command line is [ICODE]rm[/ICODE], the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a “Trash” paradigm, where files are stored before truly deleted. With the [ICODE]rm[/ICODE] utility, however, files are immediately, permanently deleted.</p><p></p><p>If you’re like me and afraid to automate permanent file deletion, you can opt for a <a href="https://www.npmjs.com/package/trash" target="_blank">utility named </a>[ICODE][URL='https://www.npmjs.com/package/trash']trash[/URL][/ICODE]. This nice Node.js library moves files to the trash instead of instant deletion.</p><p></p><p></p><p>// Install with `yarn add trash`</p><p></p><p>// Move a file to trash</p><p>const trash = require('trash');</p><p>await trash('bug-report.jpg');</p><p></p><p></p><p>There’s also a [ICODE]trash-cli[/ICODE] package for using the utility from command line:</p><p></p><p></p><p>yarn add trash-cli</p><p></p><p># Usage</p><p>trash unicorn.png rainbow.png</p><p>trash '*.png' '!unicorn.png'</p><p></p><p></p><p>[ICODE]rm[/ICODE] can be really harsh so having a [ICODE]trash[/ICODE] utility is helpful in providing users a file deletion paradigm that they’re used to.</p></blockquote><p></p>
[QUOTE="codeguru, post: 70, member: 2"] One of the first commands you learn when experimenting with command line is [ICODE]rm[/ICODE], the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a “Trash” paradigm, where files are stored before truly deleted. With the [ICODE]rm[/ICODE] utility, however, files are immediately, permanently deleted. If you’re like me and afraid to automate permanent file deletion, you can opt for a [URL='https://www.npmjs.com/package/trash']utility named [/URL][ICODE][URL='https://www.npmjs.com/package/trash']trash[/URL][/ICODE]. This nice Node.js library moves files to the trash instead of instant deletion. // Install with `yarn add trash` // Move a file to trash const trash = require('trash'); await trash('bug-report.jpg'); There’s also a [ICODE]trash-cli[/ICODE] package for using the utility from command line: yarn add trash-cli # Usage trash unicorn.png rainbow.png trash '*.png' '!unicorn.png' [ICODE]rm[/ICODE] can be really harsh so having a [ICODE]trash[/ICODE] utility is helpful in providing users a file deletion paradigm that they’re used to. [/QUOTE]
Insert quotes…
Verification
Post reply
Richest Freecoded User
Most Freecoin
freecoded
4,838 Freecoin
Davy200
590 Freecoin
J
Johnhendrick
575 Freecoin
S
Smith16
527 Freecoin
nathan69
426 Freecoin
Laureine
415 Freecoin
A
anajeen
370 Freecoin
C
codeguru
287 Freecoin
Tekera
267 Freecoin
A
Akubay
170 Freecoin
Home
Forums
TUTORIALS
CODING TUTORIALS
Node.js
Command Line trash
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top