Linux Delete dashes start with files hidden properties under Windows Bulk removal

Source: Internet
Author: User

Yesterday went to print shop printing materials, the results were poisoned, all the files are hidden, generated a bunch of shortcuts. When I got back, I ran it on the Linux machine and tried to erase the weird files. Here are the problems that are encountered in this process.

1. Unable to delete '-' Start file

Originally saw a lot of windows under the. Lnk end of the shortcut file, so, directly simple rough with RM-RF *.lnk Delete, the result error. To illustrate the situation, I have an example below, the directory only a file named "-a.txt", execute the following command, 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 the '-' file, you can use RM./-a.txt, or you can view RM--help, which is part of the information that is extracted from RM--help.

To remove a file whose name starts with a '-', for example '-foo ', use one of these commands:  rm---Foo  rm./-foo
As you can see, to delete such a file, you can also use the form RM---Foo. In fact, this is more convenient, my direct RM-*.lnk has successfully deleted all the files.

And why is that? You'll know if you try to create a file that starts with '-'.

$ touch-a.txttouch:invalid Option--'. ' Try ' Touch--help ' for more information.
It is not difficult to see that the system will '-' be understood as the beginning of an option, so the option '. ' is not supported. You may wonder why it is not suggested that you do not support option A? Because A is just an option for touch, it means only modifying the access time of the file. ^_^

2, bulk modify the hidden properties of the file

Then you will be on the Windows computer to find that all the files are set to a hidden property, and can not be modified by attributes, such as:

Here's the time for the command line to work, and the Windows command line has a attrib command that runs "help attrib" in cmd, and can get assistance with it as follows:

ATTRIB [+r |-r] [+a |-A] [+s |-S] [+h |-h] [+i |-i]       [drive:][path][filename] [/S [/d] [/l]]  +   set properties.  -   clears the attribute.  R   Read-only file properties.  A   Archive file property.  S   System file properties.  H   hidden file properties.  I have   no content index file properties.  X   No cleanup file properties.  V   Integrity Properties.  [Drive:][path][filename]      Specifies the file to be processed by the attrib.  /S  handles      matching files in the current folder and all its subfolders. /  D  also handles folders.  /L handles      the properties of symbolic links and symbolic link destinations
It is not difficult to imagine that the reason through the system interface can not directly modify the hidden properties, it is definitely a virus to add the file system files and hidden file properties, here we will remove it, with the command "Attrib-h-s/s/d *" can be. In fact, here S means sytem, which means that system files are familiar with ING, while H stands for hide, which represents hidden file attributes, very well remembered. As can be seen from here, the command operation is relative to the simplicity of the interface. This is probably why Windows has updated so many of them with one value reserved cmd. ^_^



Linux Delete dashes start with files hidden properties under Windows Bulk removal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.