Questions tagged [stat]

The stat(2) system call on POSIX systems. For statistics, use the statistics instead.

The stat(2) system call is used to retrieve information about a named file (or directory).

Links:

For statistics, use the tag instead.

829 questions
5
votes
1 answer

Are struct stat times GMT?

One of the fields in struct stat is st_mtime. I assume that is seconds since jan 1, 1970. Is that GMT or local time?
johnnycrash
  • 5,184
  • 5
  • 34
  • 58
5
votes
2 answers

How to get last modified time of a file in perl in the format returned from diff command?

I want to display time in the same format as is displayed by the linux diff command. D:\>diff -dub old.cfg new.cfg --- old.cfg 2019-05-15 15:03:14.289950700 +0530 +++ new.cfg 2019-05-14 16:07:21.119695300 +0530 I want to show last…
Kamal Nayan
  • 1,890
  • 21
  • 34
5
votes
1 answer

Using meta learning in RWeka

I used RWeka to call Weka functions directly in R. I tried using meta learning (bagging) but failed. My code is Bagging(classLabel ~ ., data = train, control = Weka_control(W = J48)) However, the following error pops up: Error in Bagging(classLabel…
Leo5188
  • 1,967
  • 2
  • 17
  • 21
5
votes
1 answer

Unix readdir (3) and stat (2) giving different inodes

I'm the teacher's assistant for my university's system's programming class. Lately the students have been working on an assignment that involves replicating the program pwd. Some of the students are noticing what appears to be an inconsistency. …
Thomas
  • 871
  • 2
  • 8
  • 21
5
votes
1 answer

Ansible: How to Check a local and remote set of files for sha1 checksum

I want to be able to do a checksum based on a list of files in a local dir. Then be able to get those files checksum and compare it to the checksum of the same files on a remote system. I know I can get the with the following # Local File - stat: …
Cale
  • 313
  • 2
  • 3
  • 7
5
votes
2 answers

Probabilistic Counting in Python

I have a 50gb txt file of random strings , out of which I want to count the number of occurrences of a substring in that file.. many times, for different not predefined random substrings. I was wondering if there is another way to approach the…
RetroCode
  • 342
  • 5
  • 14
5
votes
1 answer

Get a sorted list of folders based on modification date

I am trying to figure out how to apply a Python function to the oldest 50% of the sub-folders inside my parent directory. For instance, if I have 12 folders inside a directory called foo, I'd like to sort them by modification date and then…
stratis
  • 7,750
  • 13
  • 53
  • 94
5
votes
6 answers

Is there a faster alternative to Perl's stat?

I'm traversing an entire partition, stat()'ing each file and then checking the returned values for mtime, size and uid against hashed values. stat() however is far too slow in Perl and I'm wondering if there's any quicker alternatives I may be…
Wally
  • 51
  • 2
5
votes
3 answers

C++ system file bits/stat.h suddenly breaks with "error: field ‘st_atim’ has incomplete type"

I'm porting over a large, old system that was known to work, onto Ubuntu 64-bit Linux. The system uses FLTK, upgrading to 1.3.2, and I'm using NetBeans. A file includes basic universal /FL/Fl.H as its first line. This includes the newer unicode…
DragonLord
  • 6,395
  • 4
  • 36
  • 38
5
votes
4 answers

mv: cannot stat error : No such file or directory error

I need to move the files of a directory to another directory.I get stat error when I used the following program. for i in dir1/*.txt_dir; do mv $i/*.txt dir2/`basename $i`.txt done error message mv: cannot stat `dir1/aa7.txt_dir/*.txt': No such…
charlie
  • 75
  • 1
  • 2
  • 5
5
votes
1 answer

Is there a near equivalent to sys/stat.h in boost::filesystem?

In particular, I would like to be able to access the user_id and group_id of a file. The closest equivalent I can find to stat struct is the file_status class but this doesn't appear to have the appropriate fields.. Any idea? Cheers, Ben.
Ben J
  • 1,367
  • 2
  • 15
  • 33
5
votes
3 answers

How to check in C code whether a directory is on NFS file system?

In my C/C++ program I would like to check whether the data directory specified by user resides on NFS file system. The check is needed because the data processing latency / bandwidth is worse for the remote NFS directory. I would like to issue a…
Alexey Alexandrov
  • 2,951
  • 1
  • 24
  • 24
4
votes
2 answers

API for NCAA 2011/12 mens basketball team and player stats

I am looking for an existing API or a method to obtain NCAA Men's Basketball player and team stats. I have failed to finding anything that is easy to use or up-to-date. Any suggestions out there?
sholmes
  • 195
  • 2
  • 8
4
votes
4 answers

C Programming - Stat system call - Error

I'm new to C but trying some system calls. I'm writing program that iterates through all files in a directory and prints the current file name and size. I can get the program to print the file name but it errors when I preform the stat system…
user795954
  • 77
  • 2
  • 8
4
votes
2 answers

C stat struct does not have st_ctime field but only st_ctim

I've now been googleing this for about two hours, yet I was unable to find any answers that helped. The definition of 'stat' as spcified in the manpage says that a st_ctime field exists. struct stat { dev_t st_dev; /* ID…
user1083952
  • 41
  • 1
  • 2