RMDIR (RD) command – remove a Windows file system directory. Removing directories

Removes a directory.

Syntax

rmdir[disk: ]path [/s] [/q]

rd[disk: ]path [/s] [/q]

Options

[disk: ]path Specifies the drive and directory location to delete. /s Deletes the specified directory and all subdirectories along with files. Parameter /s used to delete a directory tree. /q Launches rmdir in hidden mode. The command removes directories without asking for confirmation. /? Displays help on the command line.

Notes

  • Using the command rmdir in the recovery console

    Team rmdir with other parameters is available in the recovery console.

  • Removing directories with hidden and system files

    Deleting directories with hidden and system files is not possible. When you try to uninstall, the following message appears:

    The directory is not empty.

    To get a list of hidden and system files, use the command dir, and to view and change attributes - the command attrib. For more information, click the "" link.

  • Using backslash

    If a backslash (\) is inserted before the first directory name, that directory will be treated as a subdirectory of the root directory regardless of the current directory name. If there is no backslash, the directory will be treated as a subdirectory of the current directory.

  • Removing the current directory

    Team rmdir cannot be used to delete the current directory. First you need to change to another directory (which is not a subdirectory of the current one) and then use the command rmdir. When you try to delete the current directory, you receive the following message:

    The file cannot be accessed because it is in use by another process.

Examples

To delete the \User\Smith directory, you must first make sure that it does not contain any files. To do this, type on the command line:

dir \user\smith /a

Only the characters “.” should be displayed on the screen. And "..".

Then, from any directory other than \User\Smith, run the following command:

rmdir\user\smith

To remove the \User directory, all files, and all subdirectories, use the following command.

Recommendations will help you completely delete the folder via command line . In the article about, the DEL command was used, which is intended specifically for files. In the case of folders, the RD or RMDIR commands are applicable.

To achieve the goal, . Enter RD /? and quickly familiarize yourself with the features and parameters of the command. Here you will see only 2 parameters:

  1. /s - when using this prefix, the folder will be deleted, as well as all its nested elements. If your directory is not empty, and you have not specified this parameter, then nothing will work for you.
  2. /Q - used when deleting without confirmation.

IN general view the design looks like this:

RD or RMDIR /s/q “full folder path”

Note: when applying the design, the directory and its contents will be completely deleted from the computer and you will not find it in the trash. For safety, do backup copy folders.

Deleting a folder with or without confirmation

I created a directory on my computer called “cmd” and copied several objects into it. Then I entered the following command into the command line:

RD /s “c:\cmd”

Then I pressed Enter and the Y key because cmd prompted me to confirm the deletion.

I checked the C drive and found no directory. Next, I created a folder named “delete” and also copied 5 files, but when entering the command, I removed the /s prefix. It turned out like this:

RMDIR “c:\delete”

After pressing Enter, the deletion did not occur, and a message was displayed on the command line that the folder was not empty. Conclusion, without the /s parameter, you can only delete an empty folder, therefore, using it without this prefix is ​​practically useless.

If you are too lazy to enter the confirmation letter (Y or N), then the following construction is for you. The /q prefix was mentioned above; it is what removes the annoying typing of letters (see the screenshot for proof).

RMDIR /Q /R /S] [ @file ] path ...

pathThe name of one or more subdirectories to remove.
@fileA text file containing the names of the directories to remove, one per line (see@file lists for details).

File Completion Syntax:

RD sets two internal variables:

%_rd_dirsThe number of directories deleted
%_rd_errorsThe number of errors

(Note that if you do an RD /S, the actual deletions are done by DEL, so check the DEL variables.)

Options:

/I"text"Select directories by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in double quotes, and must follow the/I immediately, with no intervening spaces. You can select all filenames that have a description with/I"[?]*" , or all filenames that do not have a description with/I"" . Do not use /I with @file lists. See @file lists for details.
/KWhen used with the /S option, this will physically delete files instead of sending them to the Windows Recycle Bin, even if you have the Delete to Recycle Bin configuration option set.

OPERATING SYSTEM MS DOS

Guidelines To laboratory work at the rate

"Operating systems" for students of specialty 230401 " Information Systems»

Balakovo

Goal of the work– acquisition of basic practical skills when working with the MS-DOS operating system.

Basic Concepts

Any operating system(OS) provides the user and application programs with a means of communication (interface) with numerous computer devices. It receives various commands from the user and executes them. Application programs, being launched by the user (again, not without the help of the OS), they themselves actively use the services of the OS. For example, if you need to print on a printer Text Document, That text editor, in the window of which this document is located, will not directly interact with the printer itself, but will delegate this work to the operating system. That, in turn, will check whether the printer is turned on, whether it is working properly, and whether its tray is filled with paper. And only after this will it supply text for printing in certain portions, while constantly monitoring the state of the working printer. There is a wide variety of operating systems: MS-DOS, Windows 7, Windows 2003, Linux, Unix and many others. They differ from each other in capabilities, ease of use, performance and other characteristics.

MS-DOS is an abbreviation for MicroSoft Disk Operating System, i.e. disk operating system of the American company Microsoft. The term “disk-based” means that the OS is located on a disk: either on a hard drive or on

from a floppy disk (the size of MS-DOS allows this), or even on a CD.

The algorithm for selecting a particular device is set in the BIOS. For example, if in the “BIOS FEATURES SETUP” section (Show BIOS installation)" in the "Boot Sequence" item, drives A:, C: are listed, this means the following: if a floppy disk is installed in the computer (drive A:), an attempt will be made to boot MS-DOS from it, if there is no floppy disk, then MS-DOS will boot from the hard drive (drive C:).

The MS-DOS operating system consists of the following parts:

1) BIOS (Basic Input-Output System - Basic system I/O). This part of the OS is hardwired into ROM or ROM (Read Only Memory). The BIOS contains tests for checking computer components (automatically run when the computer is turned on), as well as the Boot Loader - a small program for calling the more complex MS-DOS Loader (a fragment of the io.sys file). In addition, the BIOS performs low-level I/O operations (at the register level) with the monitor, keyboard, disks and printer.

2) Disk files io.sys and msdos. sys. The io.sys file (it is located in the initial sector system disk) contains, as mentioned, the MS-DOS Loader program. In addition, io.sys supplements the BIOS with other low-level I/O operations. The msdos.sys file provides basic high-level MS-DOS services.

3) File command.com – Command processor or MS-DOS command interpreter. Contains basic MS-DOS commands: CLS, DIR, COPY and others, called internal. In addition, it works with external MS-DOS commands, such as FORMAT, DELTREE and others, which are usually located in the DOS directory and are files with the extension .com or .exe. The command processor command.com organizes the execution of any user commands entered from the keyboard or using batch files (files with the .bat extension). The MS-DOS components listed above constitute the minimum composition of this operating system. In addition to it, you can specify such MS-DOS elements as:

4) external commands MS-DOS. They are, as mentioned, files with the extension .com or .exe and located, as a rule, in the DOS directory.

5) Drivers. This special programs(files with extensions .com, .exe or .sys), providing maintenance of new or non-standard use of existing external devices. Activation necessary drivers carried out using the config.sys and autoexec.bat files.

6) File config.sys. Represents the usual text file, containing special commands to activate various drivers. In addition, it can be used to change operating modes or the configuration of MS-DOS.

7) File autoexec.bat. This is a batch file that is automatically launched by the operating system for execution when the computer is turned on or restarted.

The user's dialogue with DOS takes place in the form of commands entered in response to the so-called operating system prompt. It is displayed on the display screen and usually looks like this:

current drive name:\current directory name>_,

where > is the system symbol;

For example, C:\lab>_,

where C is the name of the current disk;

lab – current directory name

If the current directory is the root directory, then the name of the current directory is omitted because it is the same as the name of the current drive. The prompt in this case looks like this:

C:\>_

Entering commands. DOS includes several dozen commands. They are typed on the command line after the DOS prompt. The syntax or general format of the command is as follows:

command name[arguments] ,

where arguments are the objects on which the command acts;

parameters – identifiers of command execution modes (they are separated by a slash "/ ").

To display the command's arguments and options, run help command name

To execute any command, press the Enter key (there will be no further indication of pressing the Enter key).

Basic DOS commands conditionally divided into four groups.

1. General purpose commands.

2. Commands for working with disks.

3. Commands for working with directories.

4. Commands for working with files.

This lab does not use disk management commands, so they are not discussed further.

MS-DOS has standard file type designations that allow you to visually determine the nature of files.

COM – batch file;

EXE – executive file;

BAT – batch file;

SYS - system file;

TXT – text file

General purpose commands.

The most commonly used commands in this group are:

1) cls (Clear Screen) – clears the screen;

2) ver – displays the version of the operating system installed on the computer;

3) date – display and set the current date;

4) time – display and set the current time;

5) help – output of help data on DOS commands;

To call previously entered commands to the command line and manage the list of commands, you can use the following keys:

– call the previous command;

↓ – call the next command;

F7 – displays a list of previously entered commands;

F9 – copying one of the commands from the displayed list (F7) to the command line by selecting its number;

Alt+F7 – clear the list of commands.

Commands for working with directories

Team DIR– directory – directory (directories) – serves to display a list of files and subdirectories located in the specified directory.

For example, C:\>dir – view the root directory of drive C.

С:\>dir lab – view the contents of the lab directory.

If the specified directory contains a large number of subdirectories and files, then you can organize their paged output using the /P switch. In this case, after displaying one page of the list, DOS will wait for any key to be pressed to continue displaying subsequent pages. For example, dir c:\windows /p

!! Browse the contents of the root directory of the C: drive using page-by-page browsing mode.

Team TREE– displaying the directory tree on the screen.

Command Format: TREE[drive] [path] [name] [|more]

where drive is the name of the drive on which the directory system is located;

path – path to the directory whose tree you want to view;

name – the name of this directory;

/f – mode for displaying a tree of directories with the files they contain;

|more is a command for pipeline processing of output in chunks of 23 lines.

For example, C:/>tree C: /f|more

!! Display the directory tree of drive C: in portions of 23 lines without files.

Team M.D.- Make Directory – creating directories and subdirectories.

Command Format: M.D. [drive] [path] name

where drive is the name of the drive on which the directory is created;

path – path to the created directory from the root or current directory;

name – the name of the directory to be created.

For example, C:/>md lab

!! Create a directory X on drive C:.

Team CD- Change Directory – change the current directory.

Command Format: CD [path] name

where path is the path to the subdirectory in the hierarchical file structure;

name – the name of the subdirectory that needs to be declared current.

For example, cd C:\Windows

To return to the root directory from the current subdirectory at any level, you must enter the command cd \

If you need to move up one level, you must enter the command cd..

Here (..) means the parent directory.

!! Change to directory X. Notice the changes to the DOS prompt.

!! Create two subdirectories Y and Z in the current directory.

Change the current disk. To change the current disk, you need to type the name of the drive that should become the current one. After running this command, a DOS prompt will appear with the current drive.

Copying directories. To copy one directory to another, use the command XCOPY. This command makes it possible to copy a directory while changing its name.

Command Format:

Where
where
XCOPY [drive] [path] old_name [drive] [path] old (new) name

where /s – mode for copying non-empty directories (together with files and subdirectories);

/e – mode for copying empty directories.

For example, we copy directory 1 to directory 2 as 3

xcopy d:\x\1 d\x\2\3 /s/e (do not type - this is an example)

!! Copy directory Z to directory Y under the name Q. Check the result with the TREE command.

Directory transfer. To move directories use the command MOVE.

Command Format:

MOVE [drive][path] old_name[drive] [path] [new_name]

When transferring a directory to the current directory, it is necessary to specify either the new (old) name of the transferred directory or the full path to the current directory in the addressable part “where”.

For example, see the command similar to the example above

!! Go to the root directory, then move the Q directory to the X directory. Check the result by displaying the X directory tree.

Renaming directories. The directory name is changed using the command REN.

Command Format: REN [drive] [path] name1 name2

where name1 is the old directory name;

name2 – new directory name.

!! Rename directory X to W. Test the execution of the command.

Removing directories. Directories are removed using the RD command.

Command Format: R.D.[drive] [path] name

where drive is the name of the drive on which the directory to be deleted is located;

path – path to the directory to be deleted;

name – the name of the directory to be deleted.

You can only delete a directory while outside the directory. The root directory cannot be deleted. After pressing Enter, the operating system will prompt you: Delete the directory “[drive] [path] name” along with all subdirectories? . To delete, press Y (yes) and Enter; to cancel, press N (no) and Enter.

!! Delete directory Y. Test the delete command using the TREE command.

File commands