Hot answers tagged directory
2
Most unix variants do not allow users to create files belonging to another user, for good reason.
It's rather strange that you would need that. If you want userC to be able to create and delete files inside userA/, give userC write permission to the directory. With your setup, the easiest way would be to put all these users in a common group mygroup and ...
2
I prefer incron, as its easier to manage. Essentially its a service that leverages inotify and you can setup configurations to take action based on file change operations.
Ex:
<directory> <file change mask> <command or action> options
/var/www/html IN_CREATE /root/scripts/backup.sh
You can see a full example here:
...
2
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
...
2
Directories on ext4 file systems generally have at least 2 links. The entry in their parent directory and the . entry in themselves. See there for more details.
Having said that, if the file system is inconsistent, you may very well have a directory linked in more than one place and the link count not to reflect it.
For instance, with debugfs -w (on an ...
2
First, why your attempt doesn't work: -printf "%h\n" prints the directory part of the .avi file name. That doesn't affect anything in the subsequent -exec action — {} doesn't mean “whatever the last printf command printed”, it means “the path to the found file”.
If you want to use the directory part of the file name in that cp command, you need to modify ...
1
Since you seem to be using GNU tools, you could do:
find . -name '*.avi' -printf '%h\0' |
tr '\1/' '/\1' |
LC_ALL=C sort -zu |
tr '\1/' '/\1' |
awk -vRS='\0' -vORS='\0' '
NR>1 && substr($0, 1, length(l)) == l {next}
{print; l=$0"/"}' |
xargs -r0 cp -rt /share/USBDisk1/Movies/
The above is GNU specific:
for find (because of ...
1
Doing an apache configurations is not enough. To make it work you have to configure multiple IP Address into your Centos (RedHat) box.
Assuming that you have only one phisical network interface eth0, then you have this file that contain all the relevant parameters :
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
...
1
Try to "mount --bind" the shared directory into the user's directory.
mount --bind /home/actual_share/ /home/someguy/shared/
I assume you'll need to add group write to the "actual_share".
Got the idea from this forum post.
1
I haven't tried, but something along the lines of:
#include <libgen.h>
void mkdir_recursive(char *path)
{
char *subpath, *fullpath;
fullpath = strdup(path);
subpath = dirname(path);
if (strlen(subpath) > 1)
mkdir_recursive(subpath);
mkdir(fullpath);
free(fullpath);
}
or:
#include <string.h>
void ...
1
Given those permissions, only the owner of the directory or the super user can create subdirectories.
The only way that you could avoid use extra privileges to create the folder is change the ownership to yourself (with sudo), create the subdirectory and finally return the ownership to the owner, but doesn't look like a good solution to me.
1
With GNU find (i.e. under non-embedded Linux or Cygwin), you can use -regex to combine all these -path wildcards into a single regex.
find . -regextype posix-extended \
-type d -regex '\./(\..*|Music|Documents)' -prune -o \
-type f -regex '.*(\.(bck|bak|backup)|~)' -print0 |
xargs -0 --no-run-if-empty trash-put
With FreeBSD or OSX, use -E ...
1
As far as I know, there is no option to tell find to read patterns from a file. An easy workaround is to save the patterns I want to exclude in a file and pass that file as input for a reverse grep. As an example, I have created the following files and directories:
$ tree -a
.
├── a
├── .aa
├── .aa.bak
├── a.bck
├── b
├── .dir1
│ └── bb1.bak
├── dir2
│ ...
Only top voted, non community-wiki answers of a minimum length are eligible

