Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMD Command to delete files and put them into Recycle Bin?

Is there any console command "del" to delete files from a folder and put them into Recycle Bin? del command will delete files and not in Recycle Bin.

like image 248
David.Chu.ca Avatar asked Oct 29 '09 20:10

David.Chu.ca


People also ask

Can you delete files using CMD?

If you are having trouble in deleting any file or folder directly by right-clicking, then you can delete it using cmd. The commands below delete the specific file or folder and place them in the recycle bin: del. rmdir.

How delete all files and folders using CMD?

The del command displays the following prompt: Are you sure (Y/N)? To delete all of the files in the current directory, press Y and then press ENTER. To cancel the deletion, press N and then press ENTER.

How do I delete files from my laptop using CMD?

To delete a file, use the following command: del "<filename>" . For example, to delete Test file. txt , just run del "Test File. txt" .

What is CMD delete command?

The del command is a Command Prompt command used to delete files. Various command options are available so that you can remove files that have a certain file extension, delete every file in a folder, get rid of only the files with certain file attributes, and more.


2 Answers

There is a "recycle.exe" command part of the a collection called cmdutils

"Recycle.exe is a safe replacement for the DEL command, that sends files to the recycle bin instead of deleting them. Recycle is also more flexible than DEL; you can specify multiple files at once (or use wildcards)"

Available at http://www.maddogsw.com/cmdutils
(Tool last updated May 2000)

There is "DeleteXP.exe" is for deleting files from Command Prompt in Windows (Windows 9x and Windows NT 4.0/2000/XP). Unlike, the standard "DEL" command which only deletes the file, Delete XP deletes the files and sends them to the recycle bin. The file(s) to be deleted are passed to it as parameters. It now supports /p and adds two new options /a /d /v.

Just like "del" command in Windows NT/2000/XP, Delete XP supports multiple file names as parameters even in Windows 9x.

Available at http://downloads.easytools.com/Freebies/DeleteXP.zip
(Tool last updated Sep 2004)

There is "recycle.exe" (different developer to one from maddogsw):

C:\>recycle /? Version 1.11, Copyright (C)2001 Frank P. Westlake Deletes one or more files by sending them to the Recycle Bin, if possible.  RECYCLE [/PFQ] [/A[[:]attributes]] [[drive:][path]filename  [drive:][path]filename Specifies the file(s) to delete. Specify multiple files by using wildcards. /P Prompts for confirmation before deleting each file. /F Force deleting of read-only files. /Q Quiet mode, do not ask if ok to delete on global wildcard /A Selects files to delete based on attributes     attributes R Read-only files      S System files     H Hidden files      A Files ready for archiving     - Prefix meaning not 

Available at http://web.archive.org/web/20071026113307/http://gearbox.maem.umr.edu/batch/f_w_util/
http://gearbox.maem.umr.edu/batch/f_w_util/
http://gearbox.maem.umr.edu/batch/f_w_util/recycle.zip
(Tool last updated Jan 2001)

BTW if you want to empty the recylce bin from the command line "cmdutils" has "bin" command:

bin /empty /force 
like image 147
Chris Avatar answered Oct 05 '22 01:10

Chris


Without external programs - deleteJS.bat. It uses Shell.Application invoke verb method. usage is simple:

call deleteJS.bat c:\someFile.txt call deleteJS.bat d:\someFolder 
like image 45
npocmaka Avatar answered Oct 05 '22 01:10

npocmaka