New answers tagged directory
1
vote
What subdirectories of a user's home directory does the user have full control over?
By default, other unprivileged users cannot create subdirectories in your home directory. If they were able to do so that would be a huge security hole.
However, as said by @Jörg, the privileged user (...
0
votes
Checking if there's a file with a particular name in a lot of directories
Similar to @waltinator's comm utility idea, grep can be useful in removing a set of strings from its standard input.
$ find mypath/ -type d |
grep -Fvxf <(find mypath/ -name \*.bam -type f -...
0
votes
Checking if there's a file with a particular name in a lot of directories
With the bash shell, you can test whether the current directory contains any names ending in .bam, and print a message if it doesn't, like so:
shopt -s dotglob nullglob
set -- ./*.bam
[ "$#" ...
1
vote
Checking if there's a file with a particular name in a lot of directories
In zsh:
if ()(($#)) **/*.bam(ND.Y1)); then
print There is at least one regular file in here whose name ends in .bam
fi
directories_without_bam=(
**/*(ND/^e['()(($#)) $REPLY/*.bam(ND.Y1)'])
)
if (...
0
votes
Is there any way to prevent deletion of certain files from user owned directory?
You asked about Linux specifically, but just for the benefit of other readers of these questions, BSD and macOS have chflags which can also be used to completely protect the files (and not just from ...
0
votes
Accepted
What subdirectories of a user's home directory does the user have full control over?
None.
The system administrator can always override any restrictions.
0
votes
Any command to exclude all types of files only?
You can use the following rsync options to only copy directory tree :
rsync -av -f"+ */" -f"- *" /path/to/src /path/to/dest/
Command explained in details there :
https://www....
1
vote
find & cp command doesn't copy 1st level directory
-maxdepth 1 is a directive for find. Because of it your find will run cp … for ./1 and it won't run cp … for ./1/1-1; and so on. Note it will run cp … for . in the first place.
When your find runs cp -...
1
vote
Copy directory not just the contents
Also, make sure that the first argument (the directory you want to copy) doesn't end with a forward-slash character /. Some versions of cp (for example on MacOS) treat it as /* and copy just the ...
Top 50 recent answers are included
Related Tags
directory × 1760files × 294
linux × 262
bash × 212
permissions × 194
shell × 169
find × 147
shell-script × 128
filesystems × 128
ls × 106
rm × 102
command-line × 97
filenames × 86
symlink × 72
rename × 64
mv × 64
cd-command × 61
cp × 58
directory-structure × 54
tar × 47
recursive × 46
ubuntu × 45
mount × 38
scripting × 36
mkdir × 36