Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   Command to find file attributes (http://www.programmingforums.org/showthread.php?t=10132)

Creator Jun 2nd, 2006 6:43 AM

Command to find file attributes
 
hi guys,
Is there any command or function through which i can get attributes of a file
like following attributes
hidden
archive
read
etc

DaWei Jun 2nd, 2006 8:04 AM

Please note that it is against forum rules to cross-post. Be a real gentleman and READ the friggin' rules, wouldya?

jim mcnamara Jun 5th, 2006 9:12 AM

Those attributes are for Windows files, not UNIX files. e.g., there is no such thing as a hidden UNIX file.

Infinite Recursion Jun 5th, 2006 9:38 AM

Using `ls -lastr` would give you a decent list of file properties. The "hidden" files in linux are typically called "dot files". If you preceed the filename with a dot (as in .fileName), it would "hide" from the default `ls` command.

The -a flag of the ls command would find all dot files, so in effect they aren't really hidden. However, you could probably effectively hide a file by prefixing the filename with nongraphic characters. Although the -b flag of `ls` would print octal escapes in the place of the nongraphic character... The use of -b is not as commonly known as -a.

When in doubt, encrypt the file and change ownership and permissions.

jim mcnamara Jun 6th, 2006 11:14 AM

IF -

I disagree - you can hide unix files the way you describe but stat - which is the definitive statement about file properties -- does not have any such thing as hidden in UNIX files. Windows filesystems support that property - as well as archive, etc.

I am not arguing "functionality" I'm arguing defined properties - what you did was to confuse the poor OP. IMO.

I guess shell scripting includes windows/DOS bat files. There isn't a stat shell command available from standard Windows XP distributions, so that leaves UNIX :)
Well, Linux stat....

Hence, the comment.

a thing Jun 6th, 2006 2:49 PM

By the way, Windows files having the archive flag means nothing. I've seen many non-archive files with it.

Ooble Jun 6th, 2006 7:08 PM

The Archive flag was created so backup utilities would know which files to back up. I don't believe it's used much in practice.


All times are GMT -5. The time now is 11:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC