DOS Delete Folder Rd_dos/bat

Source: Internet
Author: User
Tags parent directory
The answer is no, because the Delete folder must use the RD command, which is called the ^_^ specializing in the operation.

Another alternative to Rd is RmDir, which comes from remakedirectory. The method used is also simple: Rd folder name, for example, RD test. It supports folder names with paths, for example, RD D:\test.

Sometimes, RD doesn't do a good job: you let it delete the test folder, but it's arrogant to roll your eyes: The directory is not empty. However, this also can not blame it lazy not work, but it's a bit strange temper: if you want to delete the folder below there are sub files, you have to give rd hat, add a/s parameter, it will happily help you do things, so, the correct way to write is: rd/s test.

If you're a total slacker, just use rd/s test, you may not be satisfied with it, because when you delete the file folder, Cmd always loser to stop and ask you politely: do you confirm (y/n)? must wait for you to lose a character to knock down the carriage. Commiseration can not blame the government, point back can not blame society, who called Rd has so great power, it once play rogue come, that is who also can not stop--rd risk, delete must be cautious ah. Fortunately, Microsoft for those who are very sure of the deletion and lazy to kill the guy considerate, provides a very convenient parameter/q, which is taken from quiet, officially explained: Quiet mode, with/S delete the tree does not require confirmation. Try again this time: rd/q/s Test, the whole is: a flick of the fingers, the Ashes, is not the heart does not see the feeling of a sense of annoyance?

I met a virus today, very stubborn, it generated a virus boot file and a folder on the U disk, and was hidden, using the Folder Options menu--"View"--select "Show All Files and folders" and remove "Hide protected system files". The Auturun.inf virus boot file was deleted, but the hidden folder was not visible.
Run the cmd command, switch to the disk character of U disk, use command dir/a can see the hidden folder. I wanted to use the RD command to delete it directly and found that it was not possible to do so, and here's how to delete a folder using the RD DOS command.
First you want to use dir/a to display all the hidden files and folders, and then there are two ways to complete the deletion of the hidden folder:
If you want to delete the hidden folder 001 under D disk, but there are many files in 001, but there are no folders?

1. Use the CD folder name to switch to the folder you want to delete, Del */F, and then the RD folder name below is the command example,
Run cmd command
Copy Code code as follows:

D:
CD 001
Del */F
Cd..
RD 001

The parameter/F here is to force the deletion of the read-only property file, CD ... is to return to the parent directory.

2, want to delete the D Disk 001 folder directly, regardless of the contained files and folders, you can directly use the RD folder name/q/s, the following is a command example.
Copy Code code as follows:

D:
RD 001/S/Q

The/s is a direct deletion of the directory structure under this folder, containing all subfolders and subfolders,/q is quiet mode, no more confirmation.
The above example is used to delete the deletion of the folder can not be deleted directly, or directly delete, do not need to be so troublesome, so as to avoid the wrong order, causing inconvenience.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.