Read and write metadata to the directory itself
NNBnh opened this issue · comments
Hello, i realy like to use exiftool
as a ls
replacement
But when we run:
exiftool test-dir/
it output:
1 directories scanned
0 image files read
So if we are in a directory like this:
Permissions Size User Date Modified Name
drwxr-xr-x - nnb 12 Thg 2 16:50 test-dir/
drwxr-xr-x - nnb 6 Thg 2 21:12 eww/
drwxr-xr-x - nnb 6 Thg 2 23:45 flappybirdart/
.rw-r--r-- 28k nnb 7 Thg 2 22:21 bg.xcf
.rwxr-xr-x 34 nnb 12 Thg 2 17:12 coderun
.rw-r--r-- 0 nnb 1 Thg 2 16:32 doom.txt
.rw-r--r-- 3,5k nnb 6 Thg 2 21:51 no.xcf
.rw-r--r-- 829 nnb 3 Thg 2 10:40 zughy-32.gpl
then run:
exiftool -quiet -table -FilePermissions -FileSize -FileModifyDate -FileName *
we get:
rw-r--r-- 28 kB 2021:02:07 22:21:38+07:00 bg.xcf
rwxr-xr-x 34 bytes 2021:02:12 17:12:34+07:00 coderun
rw-r--r-- 0 bytes 2021:02:01 16:32:08+07:00 doom.txt
rw-r--r-- 293 bytes 2021:02:06 21:11:41+07:00 .vimspector.json
rw-r--r-- 13 kB 2021:02:08 20:53:56+07:00 mordecai2.png
rw-r--r-- 14 kB 2021:02:07 22:22:52+07:00 bg.png
rw-r--r-- 12 kB 2021:02:08 19:54:58+07:00 bird2.png
rw-r--r-- 12 kB 2021:02:08 19:53:49+07:00 bird0.png
rw-r--r-- 14 kB 2021:02:08 20:50:21+07:00 mordecai0.png
rw-r--r-- 8.9 kB 2021:02:06 14:23:49+07:00 base.png
rw-r--r-- 12 kB 2021:02:08 19:55:34+07:00 bird1.png
rw-r--r-- 13 kB 2021:02:08 20:55:13+07:00 mordecai1.png
rw-r--r-- 3.4 kB 2021:02:06 21:51:08+07:00 no.xcf
rw-r--r-- 829 bytes 2021:02:03 10:40:56+07:00 zughy-32.gpl
test-dir/
eww/
flappybirdart/
is nowhere to be found. instead we have .vimspector.json
(it's inside eww/
) and bg.png
base.png
bird0.png
bird1.png
bird2.png
mordecai0.png
mordecai1.png
mordecai2.png
(inside flappybirdart/
)
I wish exiftool
have something like the -d
option from GNU ls, this explain in ls's manpage:
...
-d, --directory
list directories themselves, not their contents
...
You can do this to list all files in a directory:
exiftool -quiet -table -FilePermissions -FileSize -FileModifyDate -FileName -fast5 -ext '*' .
This will prevent a listing of the files in each directory, but doesn't list the directory names as I think you want. I can look into doing this but it may be tricky because exiftool is file-oriented.
Also note I've added -fast5 to speed this up since you aren't extracting any real tags.
OK. Done. The new -list_dir option allows you to read/write directories as if they were regular files.
Wow this is fast, thank you for your enthusiasm! exiftool
can now be a fully ls
replacement with support for metadata and i love it 😄