File management

1.5 Given a scenario, use the appropriate Microsoft command-line tools.

📘CompTIA A+ Core 2 (220-1202)


1. File Management with Command-Line Tools

In Windows, you can manage files and folders using Command Prompt (cmd.exe). This is very powerful for IT professionals because you can automate tasks, work on servers without a graphical interface, or handle large numbers of files quickly. Three important commands for creating, removing, and copying files/folders are:

  • md – Make Directory
  • rmdir – Remove Directory
  • robocopy – Robust File Copy

1.1 md (Make Directory)

Purpose:
The md command (also called mkdir) is used to create a new folder (directory) from the command line.

Syntax:

md [path\foldername]

Examples:

md C:\Projects
  • Creates a folder called Projects in the C: drive.
md C:\Projects\2026\Reports
  • Creates multiple nested folders at once: 2026 and inside it Reports.

Key Points for Exam:

  • md can create nested folders in one command.
  • It is quick to use for scripts or automated tasks.
  • Useful in IT when deploying software that needs specific folder structures on multiple machines.

1.2 rmdir (Remove Directory)

Purpose:
The rmdir command is used to delete folders. By default, it only removes empty folders.

Syntax:

rmdir [path\foldername]

Examples:

rmdir C:\Projects\Old
  • Deletes the folder Old if it’s empty.
rmdir /s /q C:\Projects\Old
  • /s → Removes all files and subfolders inside the folder (recursive delete)
  • /q → Quiet mode, no confirmation prompts
  • Deletes Old and everything inside it silently.

Key Points for Exam:

  • rmdir is for removing directories, not individual files.
  • Use /s to delete a folder and all its contents.
  • Use /q to avoid prompts during automation.
  • Very common in IT for cleaning up old project directories or temporary folders on servers.

1.3 robocopy (Robust File Copy)

Purpose:
robocopy is a powerful file and folder copy tool. It is more reliable than the regular copy or xcopy commands because it can resume interrupted copies, copy large folders, and handle file attributes.

Syntax:

robocopy [source] [destination] [options]

Examples:

robocopy C:\Projects D:\Backup
  • Copies all files and folders from C:\Projects to D:\Backup.
robocopy C:\Projects D:\Backup /E /Z /COPYALL
  • /E → Copy all subfolders, including empty ones
  • /Z → Restartable mode (good for network interruptions)
  • /COPYALL → Copies all file attributes, timestamps, and permissions

Why IT Pros Use robocopy:

  • Backing up files from servers to external storage or network drives.
  • Migrating data between directories or drives without losing permissions.
  • Automating large file transfers in scripts or batch jobs.

Key Points for Exam:

  • robocopy is more advanced than copy/xcopy.
  • Handles large directories and maintains file security permissions.
  • Can resume copying if a network fails, making it highly reliable.

Summary Table for Exam

CommandPurposeKey Options / Notes
mdCreate a folderCan create nested folders in one command
rmdirRemove a folder/s deletes all files/folders, /q suppresses prompts
robocopyCopy files/folders robustly/E copy subfolders, /Z restartable, /COPYALL copies all attributes

Exam Tips

  1. Remember md = make directory, rmdir = remove directory, robocopy = robust copy.
  2. rmdir alone only deletes empty folders; /s is required for full deletion.
  3. robocopy is the go-to for server backups and large folder copies.
  4. Understand syntax and options, because multiple-choice questions often test whether you know which command and flags to use in IT scenarios.

Buy Me a Coffee