Yesterday a friend asked AnonyViet how to delete all files with extension *.abcxyz? Suddenly her computer appeared some files with strange extensions? Of course there is, but not deleting by clicking from the file that we will use the command. If you have a case that you want to delete all files with the same extension (extension) aka Extension, we can use cmd on Windows or Terminal on Linux to perform deletion quickly.
Join the channel Telegram belong to AnonyViet ???? Link ???? |
In case you encounter files with strange extensions, it may be caused by Viruses or other software. Deleting files to consider is definitely not affecting the operation of the operating system. It is recommended that you back up before following the instructions below.
Command to delete all files with any extension on Windows
This deletion method will delete the file permanently, no longer in the Recycle Bin.
First you need to open cmd (press Windows + CHEAPknock up cmd, Enter).
Access the drive containing the files with the extension you want to delete. For example you see drive D: contains multiple files ending in .abcxyz, type D:
and Enter
Continue typing the command to find and delete files with the extension with the command: del /s /f *.abcxyz
(replace abcxyz with the one you want to find and delete). In there:
- del: command to delete files in Windows
- /s: find and delete in subdirectories
- /f: delete files with attribute Red-Only
- *. all files with any name. For example, if you just want to delete the file anonyviet.abcxyz, change the sign *. wall anonyviet.
- abcxyz: file extension to delete
The results will be listed which directories contain files ending in *.abcxyz
and has been removed:
Command to delete all files with any extension on Linux
On Linux, AnonyViet also often encounters the error of generating junk files due to using the wrong Plugin. A disaster when using the wrong function to create webp image files, without deleting the original file, doubles the hard drive space. Therefore, I have to find a solution to delete all files with the extension webp.
Similar to cmd on Windows, Linux has a command prompt named Terimal or you can use Putty to SSH into the command:
find . -name '*.webp' -delete
In there:
find: command to search in Linux
- . : represents the current directory. If you want to search from root, replace the sign . sign /
- -name: search by name, or extension.
- ‘*.webp’: find all files with any name and ending with webp.
- -delete: if found, delete it.
With just one basic command line, you can quickly find and delete files with any extension within seconds. Using the command is very useful, you should learn more commands on cmd or linux to support your work.