Linux deletes files that begin with a dash windows in a batch file to remove hidden properties

Source: Internet
Author: User

Went to print shop yesterday to print the material. Result poisoning. All the files are hidden. Generate a bunch of shortcut keys. Back after. I easily put it into the Linux machine and I want to delete these file monsters.

The following are the problems that are encountered with the process.

1. You cannot delete '-' at the beginning of the file

Initially saw a lot of windows next to a. lnk end of the shortcut file, so, directly simple rough with RM-RF *.lnk Delete, the result error. In order to illustrate the situation, I have made a sample below, and there is only one file named "-a.txt" in the folder. Run the following command with an error message such as the following:

RM *.txtrm:invalid Option-' A ' Try ' rm./-a.txt ' To remove the file '-a.txt '. Try ' rm--help ' for more information.

Based on the prompts. Can know. To delete the '-' file starting with RM./-a.txt, or be able to view RM--help, here is some of the information 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
From this you can see that you want to delete this file. can also be used in the form of RM---Foo. In fact, this way is more convenient, my direct RM-*.lnk on the success of all the files have been deleted.

And why is that? Let's say you try to create a file that begins 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 might be wondering. Why don't I suggest that option A is not supported? Because A is just one option for touch. It means just changing the file's access time. ^_^

2, bulk change the hidden properties of the file

Then you'll be on the Windows computer, and you'll find that all the files are set to hidden properties and cannot be changed by attributes. In detail for example with:

Here's the time for the command line to work, with a attrib command on the Windows command line. Execute "help attrib" in CMD to get assistance with it, such as the following:

ATTRIB [+r |-r] [+a |-A] [+s |-S] [+h |-h] [+i |-i]       [drive:][path][filename] [/S [/d] [/l]]  +   set properties.  -   clears the attribute.  R   reads only the file attributes.

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 directory and all of its subdirectories.

/d also processes the directory. /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 change the hidden properties, it is definitely a virus to add files to the system files and hidden file properties, here we will be able to 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. Can be seen from here. The simplicity of the command operation relative to the interface. This is probably why Windows has updated so many of them with one value reserved cmd. ^_^



Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Linux deletes files that begin with a dash windows in a batch file to remove hidden properties

Related Article

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.