Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows cmd.exe Command-Prompt ► ««« »»»

Deleting File or Folder via Command Prompt!


Deleting file or folder via command prompt on MS Windows desktop and server operating systems is a popular solution to delete!



Every once in a while, due to various reasons, one needs to clean up drive and delete duplicate photos, documents, temporary files, shortcuts, videos or other unnecessary or unused files, folders, documents, etc. via Command Prompt.
 
 
Content:

1.) ... Deleting folders via the command prompt!
2.) ... Delete files via the command prompt!
3.) ... Only delete certain files with placeholders using cmd.exe!
4.) ... What should be considered when deleting via the command prompt!
5.) ... Why delete the data via the command prompt?
6.) ... More tips for deleting via the command prompt and ... also different!



1.) Deleting folders via the command prompt!

Deleting the folder without asking whether it should be deleted with the parameter  /s /q  


C:>rmdir   /s /q C:\folder_path\destination_folder


In this example, the directory with the designation "Target_Folder" is not deleted, but all content (files) without a query or deletion confirmation!


del /q /f /s C:\folder_path\destination_folder


About the parameters 

/q  runs the operation without asking for confirmation,

/f  ignores the read-only attribute and forces deletion

/s  deletes contents from all subfolders


2.) Delete files via the command prompt!

Basically the same as deleting a folder, the parameters can also be used, unless you want to confirm the deletion every time!   



del /q /f /s C:\folder_path\dest_folder\dest_file.txt




3.) Only delete certain files with placeholders using cmd.exe!


In this example, all plain text *.txt files are in the target folder , we use all parameters from the deletion example again, since we are sure that we really want to delete irrevocably!   



del /q /f /s C:\folder_path\destination_folder\*.txt


You can also use *.jpg to delete all images, or *.docx to delete all Word documents, and so on! Wildcards are handy for filtering files! 

See also ►►  What are placeholders?



4.) What should be considered when deleting via the command prompt!

Users unfamiliar with MS Windows Desktop and Server operating systems should note that deleting a folder or directory will delete all files and folders within that folder or directory.

Restoring the deleted data is hardly possible, sometimes it makes sense to move the data instead of deleting it, for example to an external drive or USB stick, so that you can only delete it when you are absolutely sure.

►► Move files  with PowerShell and CMD, with examples?




5.) Why delete the data via the command prompt?


Sometimes it just makes sense and sometimes it is faster to delete data via the command prompt, especially if you are sure that the data is no longer needed.

You can even do it directly from the File Explorer or Quad Explorer address bar , reducing the risk of accidentally deleting the wrong files in the wrong directory.

For example:

cmd /k del /q /f /s *


There is no need to specify the path here if you are in the right folder 


(Image-1) Delete file or folder via the address bar!
Delete file or folder via address bar!

-
▲ Back to the top ▲


6.) More tips for deleting via the command prompt and ... also different!



►► Delete all files except recent via command line, script or CMD.EXE?
►► Command line to delete empty folders under MS Windows OS!
►► Delete partition with Diskpart under Windows 11, 10, ... and MS Server!
►► Delete data from hard drives securely with DiskPart via command prompt!
►► Securely delete files and folders on Windows!
►► Delete locked files and directories under MS Windows OS! 
►► Command line to delete temporary files on Windows drives!







FAQ 136: Updated on: 12 October 2022 07:56 Windows
Windows-Console

Delete the connection IPs of the visiting website via command prompt!


If you have problems establishing an Internet connection, it can be helpful to delete the connection IPs of the visiting website via the command prompt
Windows-Console

Quickly disable windows user account via command line?


Very popular is the easy and fast deactivation of users via command line on MS Windows 11, 10, and MS Server 2022, 2019, operating systems Everyone
Windows-Console

How to create a batch file on / for MS Windows?


Automation batch files for Windows are becoming more and more popular, it is even more important to correctly name and use the batch, which is often referred
Windows-Console

What are command prompt internal commands?


The Windows CMD has internal commands that are in the command prompt itself, this does not start another exe that is started separately The external commands
Windows-Console

Looking for an example of a sub-function in a batch file?


Sometimes you just want a plain example of a subfunction ergo Sub-Routine in a command prompt batch file to understand how it works The CALL command starts
Windows-Console

Rename JPEG to JPG via command line, but how?


Sometimes you just want to rename JPEG to JPG to keep things in order, you can do that easily from the command line on MS Windows Desktop and Server OS
Windows-Console

Searching in files by string via command prompt?


The classic search in files for a character string via the command prompt is hardly used anymore, but it is still available on Windows 11, 10, In order

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, console, deleting, file, folder, command, prompt, desktop, server, operating, systems, popular, solution, delete, every, once, while, Questions, Answers, Software




    

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + NewFileTime
  + DesktopClock3D
  + PointerStick
  + DesktopImages3D
  + WinPing
  + GetPixelColor
  + StressMyPC
  + DesktopSnowOK
  + Delete.On.Reboot
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Windows 2021 | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2023 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu
0.062


► Set the folder permissions for Everyone on Windows-7 (10, 8.1), how to? ◄

► Do I have advantages through hybrid hibernation under Windows 11, 10, ...? ◄

► The virus scanner never finds anything, do I need something like this under Windows-10? ◄

This website uses cookies to ensure you get the best experience on our website more Infos & Privacy Policy
....