Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not clear on exactly what the -R flag does for chflags. I was wondering if someone might be able to help me.

The man page says this:

Recurse: Change the file flags of file hierarchies rooted in the files instead of just the files themselves.

I don't understand what that means. Can someone tell me what the difference would be between chflags -R hidden and just chflags hidden?

There's an online man page here for reference: http://ss64.com/osx/chflags.html

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Recursive flag is used for directories to apply same thing to the every included file and directory(recursively again). You could also run your command without -R option for directories but it will only affect the directory itself.

If you have a directory structure as follows:

mainDir  
|_file1  
|_file2  
|_dir1  
 |_dir1_file1
 |_dir1_file2

You should run chflags with -R option to change all files flags including the lower level files(dir1_file1).

share|improve this answer
    
Excellent explantation! Thank you kindly. –  ralphthemagician Jun 24 '12 at 18:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.