Linux deletes files starting with a break and removes hidden attributes of files in batches in Windows.
I went to the print store yesterday to print the materials. The result was poisoned. All the files were hidden and a bunch of shortcuts were generated. When I came back, I checked it on a Linux machine and tried to delete the weird files. The following are the problems encountered in this process.
1. Files starting with '-' cannot be deleted.
There are many shortcut files ending with. lnk in windows. Therefore, rm-rf *. lnk is used to delete the files, and an error is returned. In order to explain the situation, I made an example below. There is only one file named "example -a.txt" in the directory. Execute the following command and the error message is as follows:
rm *.txtrm: invalid option -- 'a'Try `rm ./-a.txt' to remove the file `-a.txt'.Try `rm --help' for more information.
As prompted, you can know that to delete files starting with '-', you can use rm. /-a.txt, or you can view rm -- help. The following is the excerpt from rm -- help.
To remove a file whose name starts with a `-', for example `-foo',use one of these commands: rm -- -foo rm ./-foo
We can see that to delete such a file, you can also use the rm ---foo format. In fact, this method is more convenient. I directly deleted all the files by rm -- *. lnk.
Why? If you try to create a file starting with '-', you will know.
$ touch -a.txttouch: invalid option -- '.'Try `touch --help' for more information.
It is not hard to see that the system regards '-' as an option hitting sign, so it will prompt that the option '.' is not supported '.'. You may wonder why option a is not supported? Because a is exactly an option of touch, which means only modifying the file access time. Pai_^
2. Modify the hidden attributes of objects in batches.
Next, I checked the USB flash drive on a windows computer and found that all the files were set as hidden properties and could not be modified through the properties. For details, see:
The following figure shows how the command line works. In the windows command line, there is an attrib command. Run "help attrib" in cmd to get help about it, as shown below:
ATTRIB [+ R |-R] [+ A |-A] [+ S |-S] [+ H |-H] [+ I |-I] [drive:] [path] [filename] [/S [/D] [/L] + set attributes. -Clear attributes. R read-only file attributes. A. archive file attributes. S system file attributes. H. Hide the file attributes. I no content index file attributes. X no file cleanup property. V integrity attribute. [Drive:] [path] [filename] specifies the file to be processed by attrib. /S processes matching files in the current folder and all its subfolders. /D also processes folders. /L process the attributes of symbolic links and symbolic links
It is hard to imagine that the reason why the system interface cannot directly modify the hidden attribute is that the virus adds the system file and the hidden file attribute to the file. Here we can remove it, run the attrib-H-S/D * command. In fact, here S refers to Sytem, which indicates that the system file is familiar with ing, and H Represents Hide, which indicates that the file attribute is hidden, which is very easy to remember. It can be seen from this that the command operation is simpler than the interface. This may also be the reason why windows has updated so many times with a single value to retain cmd. ^_^