How to Delete Files Using Command Prompt and Command Line

In regard to handling everyday tasks, the command line can turn out to be powerful as well as harmful. For instance, the rm command enables you to eliminate or delete files. The rmdir command works in the same manner for directories or folders.

However, you should be cautious because unlike when you transfer files from the Finder to the Trash, it is not possible to retrieve them if you utilize these commands. Still, in case you desire to make use of the Terminal’s powers, the cmd delete file is one command which you cannot ignore.

There are ways to include a safeguard to make sure that the only files you erase are truly the ones you want to delete.

Part1. Advantages of Erasing Files Using the Command Line

It is not complicated to delete files using the Finder and you are always able to recover files from Trash in case you have a change of mind. So why take the trouble of using the command line?

Below are a number of reasons to delete files Using Command Prompt and Command Line:

Part2. Deleting Files and Folders Using Command Prompt on Windows

Are you aware it is possible to erase a file in Windows by making use of the Command Prompt? Below are some steps on how to go about it:

Steps

How to use Command Prompt to delete files and folders

1. Begin from Start, and then proceed to All Programs, Accessories and finally Command Prompt. You can alternately access the run dialog (WinKey and R) and key in ‘cmd’ but not with the quotes.

Run cmd to delete files and folders

2. Key in ‘del’ but omit the quotes.

Use cmd to delete files and folders

3. Type the file’s name and the extension. In case you are presently in the directory which contains the file, you are ready to proceed. In case you are not aware what an extension file is, key in the file inside a kind of search box (this is determined by the computer you have and the kind of search available to you). Click on the right and find properties and it will be present on the key page. It will be the same as ‘C:/myfilename.ext.’

In case you are not in the appropriate directory, you can type ‘cd’ to the directory or key in the complete file path to be erased.

Use cmd to complete file path to delete files and folders

For instance, in case you want to erase ‘file.txt’ you need to key in ‘del file.txt.’ If the file is situated on the desktop, key in ‘C: /Users/username/Desktopfile.txt’ in case you are one directory on top.

Use cmd to erase files and folders

Delete files and folders using Command Prompt

4. DEL provides support for wildcards characters also, like asterisk (*). For instance, in case you desire to delete every file on your desktop which has .wav extension, you should type ‘del C:Users/username/Desktop/*.wav.’ Deleting

Part3. Deleting files/folders using command line on Mac

Erasing folders or directories varies a bit. If you attempt to operate the rm command on a folder, the message below will appear:

Deleting files/folders using command line on Mac

It is not possible for you to erase a directory utilizing the rm command. rmdir is a special command used to delete directories. Therefore, to erase a director called Archives, operate the command below:

rmdir Archives.

Part4: Deleting a Directory as well as Files in it

  1. rm-R Archives
  2. Keep in mind that this is a permanent decision. You can however, make use of the –flag for security.
  3. rm-iR Archives
  4. This will request you to verify the deletion of every item.

Part5: Tips and Tricks for Using cmd delete file

In case you are unable to empty your Mac’s trash, the rm – R command is useful. A file may be locked or you might not be permitted to erase one or multiple files. This may be irritating; however, you can make use of the command line to get a simple solution.

1. Type as shown underneath in Terminal

2. Send the Output of a Command to the Clipboard

You will simply send the output straightaway to the clipboard.

Tips and Tricks for Using cmd delete file

From a folder, open the command prompt

You might have attempted to open the command prompt and encountered a lot of cd commands trying to access a folder. The good news is that you can save lots of time by using Explorer to open a command prompt inside a folder. You just need to hold shift, click right on a folder and the context menu will present the option.

From a folder, open the command prompt to delete

Command History

Most probably, you might have been tapping the up key to access your earlier commands; this can be tiresome if you are attempting to get a specific command. Another method you can use to see your earlier command is using the doskey command.

Doskey/history

Use the doskey command to delete files and folders

If you lost data on your computer unfortunately, don't worry! You still have the chance to get lost data back. To recover files from computer, you can have a try the file recovery tool.

best file recovery software
  • Recover lost or deleted files, photos, audio, music, emails from any storage device effectively, safely and completely.
  • Supports data recovery from recycle bin, hard drive, memory card, flash drive, digital camera and camcorders.
  • Supports to recover data for sudden deletion, formatting, hard drive corruption, virus attack, system crash under different situations.
  • Preview before recovery allows you to make a selective recovery.
  • Supported OS: Windows 10/8/7/XP/Vista, Mac OS X (Mac OS X 10.6, 10.7 and 10.8, 10.9, 10.10 Yosemite, 10.10, 10.11 El Capitan, 10.12 Sierra) on iMac, MacBook, Mac Pro etc.
3981454 people have downloaded it

حذف / بازگردانی فایل

فایل های پاک شده من +
  1. حذف سابقه مرور جستجو /
  2. حذف کوکی ها
  3. حذف نرم افزار
  4. حذف دانلود
  5. دائم فایل ها
  6. امن حذف
  7. فایل های deleter
  8. حذف فایل های فرمان
  9. حذف گوگل کروم
  10. حذف پوشه
  11. حذف فایل های تکراری
  12. نیروی حذف فایل های در حال استفاده
فایل های پاک دوم +
  1. حذف دکتر
  2. حذف فایل های قدیمی
  3. حذف فایل های خراب
  4. حذف فایل های قفل شده
  5. حذف فایل های پاک
  6. حذف OST. فایل ها
  7. حذف کانال های یوتیوب / فیلم
  8. حذف فایل های آشغال
  9. حذف نرم افزارهای مخرب و ویروس
  10. حذف فایل های به روز رسانی
بازگردانی فایل های من +
  1. بازیابی فایل های پاک
  2. بازیابی فایل های اخیرا حذف
  3. فایل های NTFS بازگردانی
  4. ویندوز 7 بازگردانی
  5. بازگردانی ویندوز XP
  6. بازگردانی ویندوز ویستا
  7. ابزار بازگردانی
  8. جایگزین علاوه Undelete
  9. بازگردانی 360 جایگزین
  10. جایگزین NTFS بازگردانی
  11. نرم بازگردانی
  12. بازیابی ایمیل های پاک شده
بازگردانی فایل های دوم +
  1. جایگزین بازیابی فایل های پاک شده EASEUS
  2. بازیابی فایل های حذف شده از SHIFT
  3. لغو حذف تصادفی
  4. بازیابی تماس های حذف شده
  5. بازگردانی مک
  6. بازیابی پوشه های پاک شده
  7. برنامه های آندروید به بازیابی فایل های پاک
  8. سیستم بازگرداندن فایل های پاک
  9. بازیابی فایل های پاک از آندروید
  10. بازیابی عکس های پاک
  11. بازیابی فایل های پاک شده از سطل آشغال
  12. بازیابی پارتیشن های حذف شده
  13. بازیابی فایل های حذف شده در Dropbox
Hot Articles
See MoreSee Less
Product-related questions? Speak directly to our Support Team >
Home / Deleted Files Recovery / How to Delete Files Using Command Prompt and Command Line

All TOPICS

بالا