shesser Frequent Contributor.
Frequent Contributor.
120 views

Use of the attrib command OES2015

Jump to solution

I was hoping someone new how to list files with a certain attribute (di or delete inhibit) on an nss volume. I know how to remove them from an article here https://www.zerowizard.com/?cat=16

Not sure how to set a find up using attrib and list or grep out just files that have the di attribute. Any of you command line experts know?

Thanks in advance!

Labels (1)
0 Likes
1 Solution

Accepted Solutions
benjaminhare Respected Contributor.
Respected Contributor.

Re: Use of the attrib command OES2015

Jump to solution

For all files with "delete inhibit":

 attrib [path]/* -r | grep "di "
  • attrib → By itself will simply output the file name and the assigned attributes
  • -r → Recursive, so it will travel down the directory structure
  • | grep "di " → Pipes output over to grep in order to pull out the ones you want. Note the additional space in "di ". This will match any file with the "delete inhibit" attribute

The output only lists the file name, not the directory, as seen in the following output:

# attrib /media/nss/USER/BenjaminH/* -r | grep "di "
ar di aa (db.benjaminh.local)(zid:2885281)
ar di aa (prefs.js)(zid:134791)
5 Replies
shesser Frequent Contributor.
Frequent Contributor.

Re: Use of the attrib command OES2015

Jump to solution
The command find -exec /sbin/attrib {} \; will show all files under a directory, you can redirect to a file (> filename.txt). List will list every file under every directory from where you start your find though.
0 Likes
benjaminhare Respected Contributor.
Respected Contributor.

Re: Use of the attrib command OES2015

Jump to solution

For all files with "delete inhibit":

 attrib [path]/* -r | grep "di "
  • attrib → By itself will simply output the file name and the assigned attributes
  • -r → Recursive, so it will travel down the directory structure
  • | grep "di " → Pipes output over to grep in order to pull out the ones you want. Note the additional space in "di ". This will match any file with the "delete inhibit" attribute

The output only lists the file name, not the directory, as seen in the following output:

# attrib /media/nss/USER/BenjaminH/* -r | grep "di "
ar di aa (db.benjaminh.local)(zid:2885281)
ar di aa (prefs.js)(zid:134791)
shesser Frequent Contributor.
Frequent Contributor.

Re: Use of the attrib command OES2015

Jump to solution
Thanks for the reply! I was interested mainly in how many file that may have the di attribute. If results came back with files, I would run the find command and remove it. I did this back many years ago once before when coming from netware nss to OES. There was a slew of files that had di on them and it was a pain to clear one at a time. I was just going to redirect the find command above to a file the search for the di<space> to see what it finds, but I like your idea better! I'm hoping there are none anyway, Thanks again!
0 Likes
shesser Frequent Contributor.
Frequent Contributor.

Re: Use of the attrib command OES2015

Jump to solution

So I was messing around with the find command and used the following below to grep out "di". Same basic grep with a space after di. Only difference, find gives the complete path.  Thanks again!

server:/media/nss/VOL1 # find -exec /sbin/attrib {} \; | grep "di "
di (/media/nss/VOL1/temp/fbpool/football.pdf)

server:/media/nss/VOL1 # attrib * -r | grep "di "
di (football.pdf)(zid:1152)

benjaminhare Respected Contributor.
Respected Contributor.

Re: Use of the attrib command OES2015

Jump to solution

Bless you, sir/madam. Have a like. Thanks for circling back and posting that. Very helpful. I was not aware of the -exec option to find.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.