Comments (4)
@Poshi please let me know if #1560 (merged to main
) works for you
from miller.
So far, LGTM. But would it be too much work to get the whole stats struct?
struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* inode number */
mode_t st_mode; /* protection */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of owner */
gid_t st_gid; /* group ID of owner */
dev_t st_rdev; /* device ID (if special file) */
off_t st_size; /* total size, in bytes */
blksize_t st_blksize; /* blocksize for file system I/O */
blkcnt_t st_blocks; /* number of 512B blocks allocated */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last modification */
time_t st_ctime; /* time of last status change */
};
With the inode number you can see if two files are the same.
With the number of hard links you can see if there are other pointers to this file.
With the owner and group IDs you can find the files that (does not) belong tom someone.
With the different times you can distinguish different events.
Also, not sure how to test for file existence. Call stat and check if error appear, maybe?
Distinguishing files from folders, soft links, hard links and fifos will be also welcomed.
On the other hand, the block size and the number of blocks are not relevant to me, but maybe other people find it relevant.
And going one step further from the stat call, following a soft link would be an extra point :-) But that is a completely different functionality, not just querying metadata, but the actual data of a softlink, which is the immediate destination of the softlink. And it can be followed a single step, or until the end of the potential soft links chain.
from miller.
:-O I took for given that the full stat
call results would be forwarded to any language that was using it.
Well, at least we have FileMode
in the structure. From there, the type of file can be derived (folder, regular, link, block...).
The other missing data would be useful, but just having what you already added will go a long way :-)
It is not worth looking into non-portable things, it would be a nightmare to develop, test and maintain. Better keep to the standard and portable data.
Thanks a lot!
from miller.
@Poshi that's the C stats struct :(
Go expose this os.FileInfo
and I'm using it all:
I can look into things that might vary per OS ...
from miller.
Related Issues (20)
- Inconsistent result when using `$*`
- Double-width characters spoil column alignment HOT 4
- `mlr --icsv --ojson cat < mlr.bug.csv` drops some columns HOT 5
- Add description for "put" verb HOT 1
- 'mlr cut' is very slow HOT 8
- mlr --otsv does not handle broken quotes correctly compared to --ocsv HOT 6
- JSON to CSV Error HOT 8
- exit code = 1 for --csv skip-trivial-records and csv file's last record is blank
- Automated way of clearing down column data HOT 7
- JSON flag documentation question HOT 1
- Equivalent to Excel function "data load from folder" then "combine and load" multiple CSV's finally "apply transformations" HOT 7
- Find and remove "string" retaining all other row data HOT 5
- Find and replace special character & with and using ssub HOT 2
- Notwithstanding --skip-comments, double-quoted tokens in comment are mishandled with any --c2* option HOT 3
- Completely unexpted output of put, then cut, then label HOT 3
- do we have python binding? HOT 1
- About `--transpose` in the documentation
- newlines in fields | CSV file: Header/data length mismatch HOT 4
- More than one blank line at the end of CSV file: automate cleanup?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miller.