I'd like to recursively search a directory, and output:
Filename Date Path Size
I got everything but Path...which is a $$$$buster....
Here's my command so far:
ls -lThR {DIRECTORY_NAME_HERE} | awk '/^-/ {print $10 " " $6 " " $7 " " $8 " " $5}'
I wish there was a way to combine that command with:
find ./{DIRECTORY_NAME_HERE} -type f
which just shows /path/to/filename itself...no other metadata afaik.
Any ideas...hopefully without needing a programming language?
EDIT: Here's the exact output I was looking for assuming file is 5 bytes:
myfile.txt Dec 2 10:58 /path 5
UPDATE: Here's the command I wound up with:
find ./{DIRECTORY_NAME_HERE} -type f -ls |
while read f1 blocks perms blocks owner group size mon day third file;
do echo `basename $file` `ls -lrt $file | tr -s " " | cut -d" " -f6-8` `dirname $file` `ls -lrt $file | tr -s " " | cut -d" " -f-5`; done
If someone can improve it, that'd be great, but this works...
Have you tried find ./delete -type f -ls
(note the -ls
-- that's the key :-) )? You should then be able to pipe the results through awk
to filter out the fields you want.
Edit... Another way you could do it is with a while loop, e.g.:
find ./delete -type f -ls | while read f1 blocks perms blocks owner group size mon day third file
do
echo `basename $file` `dirname $file`
done
and add the bits you need into that.