|
| ||||||||||
| Tags: attribute, command line options, file attribute, filename, hidden attribute, read only attribute, set file attribute, system file attribute, vbnet |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to set file attribute?
I am a software programmer and i am at beginning stage so i am not much familiar with the setting file attribute in programming. So I want to know how to set the file attribute for different language, like VB, VB.net, C, C++ etc. If anyone know please help me out. Last edited by Julli_gaada : 21-11-2009 at 06:35 PM. |
|
#2
| ||||
| ||||
| Re: How to set file attribute?
Hey Friend, Here i am giving you some codes for setting file attribute just use them as per your requirement. To set a file attribute of the VB: Code: Public Shared Sub SetAttributes ( _path As String, _fileAttributes As FileAttributes _) Dim path As String Dim fileAttributes As FileAttributes File.SetAttributes(path, fileAttributes) Code: public static void SetAttributes(string path, FileAttributes fileAttributes) |
|
#3
| ||||
| ||||
| Re: How to set file attribute?
You can also use a well known command for setting the file attribute is "ATTRIB" If you want to set a file attribute to archive and to remove archive: Code: attrib +a filename Code: attrib -a filename For setting system file attribute and to remove system file attribute: Code: attrib +s filename Code: attrib -s filename For setting hidden attribute and to remove hidden attribute: Code: attrib +h filename Code: attrib -h filename For setting read only attribute and to remove read only attribute: Code: attrib +r filename Code: attrib -r filename |
|
#4
| ||||
| ||||
| Re: How to set file attribute?
ATTRIB used to displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories. Used without parameters, attrib displays attributes of all files in the current directory. Syntax attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[Drive:][Path] FileName] [/s[/d]] Parameters +r : Sets the read-only file attribute. -r : Clears the read-only file attribute. +a : Sets the archive file attribute. -a : Clears the archive file attribute. +s : Sets the system file attribute. -s : Clears the system file attribute. +h : Sets the hidden file attribute. -h : Clears the hidden file attribute. [ Drive : ][ Path ] FileName : Specifies the location and name of the directory, file, or set of files for which you want to display or change attributes. You can use wildcard characters (that is, ? and *) in the FileName parameter to display or change the attributes for a group of files. /s : Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. /d : Applies attrib and any command-line options to directories. /? : Displays help at the command prompt. Thank you |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to set file attribute?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Retrieve attribute as string | ISAIAH | Software Development | 5 | 27-02-2010 12:51 AM |
| How to modify file attribute in Windows 7? | seema_thk | Operating Systems | 5 | 05-01-2010 09:39 PM |
| How to set HTML Tag Attribute in asp.net | Shashee | Software Development | 3 | 08-06-2009 10:39 PM |
| Howto add new attribute via LDIF file | Manolax | Active Directory | 1 | 11-11-2008 05:57 PM |
| Custom AD attribute - [WP] | OmJaa | Active Directory | 3 | 11-03-2008 07:17 PM |