3
votes
3answers
52 views

Full path in glob in Zsh

Say I run the following on /some/path: for x in foo/*; do print $x done Are there any parameters I can use to tell Zsh to print, not just the filename, but the full absolute path to $x? (without ...
5
votes
3answers
322 views

Getting relative links between two paths

Say I have two paths: <source_path> and <target_path>. I would like my shell (zsh) to automatically find out if there is a way to represent <target_path> from <source_path> as ...
5
votes
2answers
1k views

Disk usage summary per user

Is there a way to get the disk usage per user under a given path? du doesn't seem to have an option to aggregate disk usage per user, and df only seems to report how much disk is left on the drive. ...
2
votes
2answers
199 views

Unable to concatenate files with find ./subdir/* -print0 | sort | xargs -0 cat > merge.txt

I am trying to concatenate thousands of files that result from processing the pieces output by split with find ./subdir/* -print0 | sort | xargs -0 cat > full_merge.txt The files under subdir ...
2
votes
2answers
222 views

Distributing thousands of files over subfolders

I have a folder A with hundreds of thousands of files. I would like to move these files to new subfolders S_i, with, say, 100 files in each (the last folder may have less than 100 files) In other ...
2
votes
2answers
383 views

Pre-defined umask under a given path [duplicate]

Possible Duplicate: How to set default file permissions for all folders/files in a directory? Say I have default umask, umask1. I would like all files/folders that I create/modify under a ...
0
votes
1answer
771 views

Asking ls to only list files in a path that match a specific glob/regex

In Zsh: Is there a way to use ls to only list files and folders in the current directory that match a specific globbing or regex pattern? For example, say I have multiple files that start with the ...
6
votes
4answers
1k views

List X random files from a directory

Is there a way to list a set of say, 30 random files from a directory using standard Linux commands? (in zsh) The top answer described here does not work for me (sort does not recognize the option ...
3
votes
2answers
728 views

Counting files in leaves of directory tree

I came up with the following snippet for counting files in each subdirectory: for x (**/*(/)); do print $x; find $x -maxdepth 1 -type f | wc -l; done The command outputs consecutive pairs (one ...