Today I was sorting out the code examples and found that the batch files written before for some files still failed to be executed to delete the files with specific suffixes.
So I studied it carefully and solved the problem del /a /f /q Directory :
\*.suffix--
-------------------------------------------------- ---------
To delete all suffixes in D:\My Documents and D:\My Documents\Desktop,
write:
del /a /f /q "D:\My Documents\* .doc" "D:\My Documents\Desktop\*.doc"
---------------------------------- ----------------------------
* is a wildcard character
/a /f is to force the deletion of files with all attributes
/q is to delete directly without confirmation
. Together with the /s switch, you can delete files in subfolders
--------------------------------- --------------------------
del /a /f /s /q D:\*.doc
can delete all DOC suffix files on the D drive , without confirmation.
Example of the final exercise:
E:\StudyTemp>del /F /Q /S *.suo
E:\StudyTemp\*.suo not found
E:\StudyTemp>del /F /Q /a *. suo
cannot find E:\StudyTemp\*.suo
E:\StudyTemp>del /F /Q /A *.suo
cannot find E:\StudyTemp\*.suo
E:\StudyTemp>del /F /Q /A /S *.suoDelete
file - E:\StudyTemp\AvlExample01\AvlExample01.v12.suoDelete
file - E:\StudyTemp\MyDBTest\MyDBTest.suoDelete
file - E:\StudyTemp\NetMap\NetMap.v12.suoDelete
file - E:\StudyTemp\SATest\SATest.v12.suo
Delete file - E:\StudyTemp\SearchUSBPortConsole\SearchUSBPortConsole.v12.suo
Delete file - E:\StudyTemp\SPortTest\SPortTest.suo
Delete file - E:\StudyTemp\Win32Console001 \Win32Console001.v12.suo
E:\StudyTemp>
In fact, you should directly look at the help of del initially.
E:\StudyTemp>del /?
Delete one or several files.
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[ :]attributes]] names
names specifies one or more files or directory lists.
Wildcards can be used to delete multiple files.
If a directory is specified,
all will be deleted.
/P Prompt for confirmation before deleting each file.
/F Forces deletion of read-only files.
/S Delete the specified files in all subdirectories.
/Q Quiet mode. When deleting a global wildcard, confirmation is not required
/A Select files to delete based on
attributes R Read-only files S System files
H Hidden files A Archive files
I Contentless index files L Reparse points
- prefix indicating "no"
if the command is expanded is enabled, DEL and ERASE change as follows:
The display syntax of the /S switch will be reversed, that is, only
deleted files will be displayed instead of files that cannot be found.