Archive for June, 2012

unset all file flags

June 11th, 2012 Comments off

Sometimes you cannot simply delete a file or a directory. It fails with an error indicating that this operation is not permitted. In my example I tried to cleanup an old tinderbox build:

# rm -rf tinderbox/7.3_freebsd_i386/
rm: tinderbox/7.3_freebsd_i386/bin/rcp: Operation not permitted
rm: tinderbox/7.3_freebsd_i386/bin: Directory not empty
rm: tinderbox/7.3_freebsd_i386: Directory not empty

It is obvious that tinderbox uses special file flags to protect the build. Since I want to delete it anyway, I don’t need to find out which flag is set und must be unset. So I just unset all flags:

# chflags -R 0 tinderbox/7.3_freebsd_i386/

Finally the old build directory can be deleted.

Categories: [EN] Snippets Tags: , ,