Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Chattr recursive exclude directory Post 303043167 by carnagel on Monday 20th of January 2020 11:49:17 AM
Old 01-20-2020
Chattr recursive exclude directory

Attempting to recursive chattr directories while excluding a directory, however the command which works with chown does not seem to with chattr

Code:
find /mysite/public_html ! -wholename '/mysite/public_html/images' -type d -exec chattr -R +i {} \;

Code:
find /mysite/public_html -not -path "*/images*" -type d -exec chattr -R +i {} \;

Both commands still attempt to execute the chattr command on the excluded folder. Any help appreciated.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Tar directory but exclude other

OS: SunOS perfs01 5.8 Generic_117350-23 sun4u sparc SUNW,UltraAX-i2 I want to tar a directory, but there are subdirectoires I want to exclude. Does anyone know how to do it? Please help. thanks. (1 Reply)
Discussion started by: leemjesse
1 Replies

2. Programming

recursive copy of the directory

I want to copy a directory recursively ( it again has directories) and the directory is on windows and is nfsmounted in vxWorks, i am using unix to develop the code for this, can any one suggest me how to copy the directories recursively. (7 Replies)
Discussion started by: deepthi.s
7 Replies

3. UNIX for Dummies Questions & Answers

Exclude a directory to tar

If use tar file from a directory , how to exclude a sub-directory in this directory ? ll drw-r--r-- 1 root root 4096 Oct 12 11:58 b drw-r--r-- 1 root root 4096 Oct 12 10:54 c drwxr-xr-x 2 root root 4096 Oct 12 11:57 d drw-r--r-- 1 root root 4096 Oct 12 10:54 d eg . I want to tar all files... (2 Replies)
Discussion started by: ust
2 Replies

4. UNIX and Linux Applications

CVS recursive diff -- how to exclude specific directories?

I think I've seen out there that there is a command to ignore specific files within a directory when doing a (-R) recursive diff. I've never used this so I was wondering if there was anyone who could provide an example how I would run this. My thoughts are something like: cvs diff -i <fileName1>... (2 Replies)
Discussion started by: airon23bball
2 Replies

5. Programming

Recursive remove directory.

What is the best way to completely remove dir with it's content ??? rmdir deletes only EMPTY dirs as i know. The man page of remove function says "remove() deletes a name from the file system." Can it remove any dir recursively ??? :rolleyes: (7 Replies)
Discussion started by: Trump
7 Replies

6. UNIX for Dummies Questions & Answers

recursive wc on a directory?

Hi all, I need to count the number of lines in all the files under a directory (several levels deep). I am feeling extremely dumb, but I don't know how to do that. Needless to say, I am not a shell script wiz... Any advice? thanks in advance! (13 Replies)
Discussion started by: bimba17
13 Replies

7. Shell Programming and Scripting

Exclude a directory in 'find'

Hi, I'm in the process of writing a shell script which will be ran under cron hourly and will check for files of specific age in my ftp folder, then moves those over inside a folder called "old" (which is within the ftp dir). But, I'm unable to figure out how to exclude the "old" folder when... (1 Reply)
Discussion started by: mutex1
1 Replies

8. UNIX for Advanced & Expert Users

Recursive directory search using ls instead of find

I was working on a shell script and found that the find command took too long, especially when I had to execute it multiple times. After some thought and research I came up with two functions. fileScan() filescan will cd into a directory and perform any operations you would like from within... (8 Replies)
Discussion started by: newreverie
8 Replies

9. UNIX for Dummies Questions & Answers

recursive copy into a directory and all its subdirectories...

I want to copy a file from the top directory into all the sub-folders and all of the sub-folders of those sub-folder etc. Does anyone have any idea how to do this? Thanks in advance of any help you can give. (3 Replies)
Discussion started by: EinsteinMcfly
3 Replies

10. Cybersecurity

Alternative for chattr

Hello im working on "remover script" which try to remove "kthrotlds MINER VIRUS" in next part of my remover script i have to work on files that it destroyed, virus use chattr to open and lock files and replace them with malicious content im looking for a solution to remove chattr and disable... (9 Replies)
Discussion started by: nimafire
9 Replies
IOCTL_IFLAGS(2) 					     Linux Programmer's Manual						   IOCTL_IFLAGS(2)

NAME
ioctl_iflags - ioctl() operations for inode flags DESCRIPTION
Various Linux filesystems support the notion of inode flags--attributes that modify the semantics of files and directories. These flags can be retrieved and modified using two ioctl(2) operations: int attr; fd = open("pathname", ...); ioctl(fd, FS_IOC_GETFLAGS, &attr); /* Place current flags in 'attr' */ attr |= FS_NOATIME_FL; /* Tweak returned bit mask */ ioctl(fd, FS_IOC_SETFLAGS, &attr); /* Update flags for inode referred to by 'fd' */ The lsattr(1) and chattr(1) shell commands provide interfaces to these two operations, allowing a user to view and modify the inode flags associated with a file. The following flags are supported (shown along with the corresponding letter used to indicate the flag by lsattr(1) and chattr(1)): FS_APPEND_FL 'a' The file can be opened only with the O_APPEND flag. (This restriction applies even to the superuser.) Only a privileged process (CAP_LINUX_IMMUTABLE) can set or clear this attribute. FS_COMPR_FL 'c' Store the file in a compressed format on disk. This flag is not supported by most of the mainstream filesystem implementations; one exception is btrfs(5). FS_DIRSYNC_FL 'D' (since Linux 2.6.0) Write directory changes synchronously to disk. This flag provides semantics equivalent to the mount(2) MS_DIRSYNC option, but on a per-directory basis. This flag can be applied only to directories. FS_IMMUTABLE_FL 'i' The file is immutable: no changes are permitted to the file contents or metadata (permissions, timestamps, ownership, link count and so on). (This restriction applies even to the superuser.) Only a privileged process (CAP_LINUX_IMMUTABLE) can set or clear this attribute. FS_JOURNAL_DATA_FL 'j' Enable journaling of file data on ext3(5) and ext4(5) filesystems. On a filesystem that is journaling in ordered or writeback mode, a privileged (CAP_SYS_RESOURCE) process can set this flag to enable journaling of data updates on a per-file basis. FS_NOATIME_FL 'A' Don't update the file last access time when the file is accessed. This can provide I/O performance benefits for applications that do not care about the accuracy of this timestamp. This flag provides functionality similar to the mount(2) MS_NOATIME flag, but on a per-file basis. FS_NOCOW_FL 'C' (since Linux 2.6.39) The file will not be subject to copy-on-write updates. This flag has an effect only on filesystems that support copy-on-write semantics, such as Btrfs. See chattr(1) and btrfs(5). FS_NODUMP_FL 'd' Don't include this file in backups made using dump(8). FS_NOTAIL_FL 't' This flag is supported only on Reiserfs. It disables the Reiserfs tail-packing feature, which tries to pack small files (and the final fragment of larger files) into the same disk block as the file metadata. FS_PROJINHERIT_FL 'P' (since Linux 4.5) Inherit the quota project ID. Files and subdirectories will inherit the project ID of the directory. This flag can be applied only to directories. FS_SECRM_FL 's' Mark the file for secure deletion. This feature is not implemented by any filesystem, since the task of securely erasing a file from a recording medium is surprisingly difficult. FS_SYNC_FL 'S' Make file updates synchronous. For files, this makes all writes synchronous (as though all opens of the file were with the O_SYNC flag). For directories, this has the same effect as the FS_DIRSYNC_FL flag. FS_TOPDIR_FL 'T' Mark a directory for special treatment under the Orlov block-allocation strategy. See chattr(1) for details. This flag can be applied only to directories and has an effect only for ext2, ext3, and ext4. FS_UNRM_FL 'u' Allow the file to be undeleted if it is deleted. This feature is not implemented by any filesystem, since it is possible to imple- ment file-recovery mechanisms outside the kernel. In most cases, when any of the above flags is set on a directory, the flag is inherited by files and subdirectories created inside that directory. Exceptions include FS_TOPDIR_FL, which is not inheritable, and FS_DIRSYNC_FL, which is inherited only by subdirectories. CONFORMING TO
Inode flags are a nonstandard Linux extension. NOTES
In order to change the inode flags of a file using the FS_IOC_SETFLAGS operation, the effective user ID of the caller must match the owner of the file, or the caller must have the CAP_FOWNER capability. SEE ALSO
chattr(1), lsattr(1), mount(2), btrfs(5), ext4(5), xfs(5), xattr(7), mount(8) Linux 2017-09-15 IOCTL_IFLAGS(2)
All times are GMT -4. The time now is 04:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy