This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Use of the attrib command OES2015

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!

Parents
  • Verified Answer

    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)
  • 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!
  • 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)

  • 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.

Reply Children
No Data