Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 2nd, 2006, 6:43 AM   #1
Creator
Newbie
 
Creator's Avatar
 
Join Date: May 2006
Location: India
Posts: 2
Rep Power: 0 Creator is on a distinguished road
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
Creator is offline   Reply With Quote
Old Jun 2nd, 2006, 8:04 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Please note that it is against forum rules to cross-post. Be a real gentleman and READ the friggin' rules, wouldya?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 5th, 2006, 9:12 AM   #3
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
Those attributes are for Windows files, not UNIX files. e.g., there is no such thing as a hidden UNIX file.
jim mcnamara is offline   Reply With Quote
Old Jun 5th, 2006, 9:38 AM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,453
Rep Power: 7 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jun 6th, 2006, 11:14 AM   #5
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
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.
jim mcnamara is offline   Reply With Quote
Old Jun 6th, 2006, 2:49 PM   #6
a thing
Unverified User
 
a thing's Avatar
 
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0 a thing is on a distinguished road
By the way, Windows files having the archive flag means nothing. I've seen many non-archive files with it.
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
Got 'Nux?—GNU/Linux and other free software support.
It's GNU/Linux, not just Linux.
a thing is offline   Reply With Quote
Old Jun 6th, 2006, 7:08 PM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 8 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:48 PM.

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