Looking for C++ code to get file informations like file size, date created, etc

linux

    Next

  • 1. install file
    Hi I am new to linux , If am going to install file where i have to keep that file ?in the root or any directory. and it is deamon process that have to run
  • 2. stdin in xterm
    Hi guys, I am running an application from with xterm terminal window on pty slave pts/2 (for example). The application just reads user input from stdin (using getc()). stdin handle seems to be mapped to pts/2. I am trying to feed input from another terminal to my application redirecting it to pts/2 - "echo "..." > /dev/pts/2". The result is that the input appears in the xterm on pts/2 but the application does not see anything on stdin (doing getc() read for example). Can someone help me understand this phenomenon. Thanks, Igor

Looking for C++ code to get file informations like file size, date created, etc

Postby atkhan » Mon, 13 Sep 2004 04:24:30 GMT

Looking for C++  code to get file informations like file size, date created, etc.
Any suggestions?

-Tamim

Re: Looking for C++ code to get file informations like file size, date created, etc

Postby Paul Pluzhnikov » Mon, 13 Sep 2004 04:49:43 GMT

 XXXX@XXXXX.COM  (Janice) writes:


Try "man stat"

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

Re: Looking for C++ code to get file informations like file size, date created, etc

Postby Larry I Smith » Mon, 13 Sep 2004 11:30:31 GMT



 From a command line run:

    man 2 stat

Larry

-- 
Anti-spam address, change each 'X' to '.' to reply directly.

Re: Looking for C++ code to get file informations like file size, date created, etc

Postby dattaster » Mon, 13 Sep 2004 14:46:57 GMT



Well, what I did was to write a simple awk script and call that from one 
of my programs and redirect its output to a file which I could parse in 
the program. I am sure there are better ways to do this but this one 
cheap and easy way to do it.

More information regarding the purpose of you trying to do this would 
probably help me give u a better advice....

Ankur

Similar Threads:

1.how to test file size and creation date in Bash command file

I have a Bash command file with a for loop to process all the files in a 
directory.  But what I want to do is process only files larger than 1 MB 
that were created on the day the command file is run.

How do I test the file size and file creation date in a Bash command file?

Thanks,
   Jeff

2.Creating a tar file with only files that have changed since a specified date

In article < XXXX@XXXXX.COM >, Luuk says...
> jeremy schreef:
> > 
> > tar -cf fred.tar `find . -mtime -10`
> > 
> > Doesn't get much simpler, huh?
> > 
> > thanks for your patience
> > 
> 
> ok, suc6, until you get this error from tar:
> "Argument list too long"
> 
> than you'll have to use Google again to find a solution for that too ;-)
> 
> 

Actually I may have been a bit hasty :(

whilst the command 
find . -mtime -2

lists all files changed in the last 2 days (240) I now see this is NOT a 
valid argument to the tar commnd:

tar -cf fred.tar `find . -mtime -2 `

I ctrl+c the tar after a few seconds - had 1300 files already written.

is there a way to appaned e.g. the \ char to the end of each line 
returned by find? Or have I missed something obvious?

-- 
jeremy

3.Creating a tar file with only files that have changed since a specified date

In article < XXXX@XXXXX.COM >, Luuk says...
> > ls -l
> > 
> > I would have thought (wondered) it was a function of the ls command that 
> > could display the output in the format I want?
> > 
> > If push comes to shove I can pipe the output through cut to ignore the 
> > stuff I don't want I guess but would rather use the simplest method.
> > 
> 
> /home/luuk $ find ~luuk -name "*.log"
> will find any log-file in my home-dir, or in one of its sub-folders..
> 
> to find out where find is on my system:
> /home/luuk # find / -name find
> /usr/bin/find
> /usr/lib64/find
> 

Apologies - the output I want is the default output from find.

[smacks forehead]

So this creates my tar file with just the files that have changed in the 
last 10 days:

tar -cf fred.tar `find . -mtime -10`

Doesn't get much simpler, huh?

thanks for your patience

-- 
jeremy

4.Creating a tar file with only files that have changed since a specified date

(I did also post this to comp.unix.solaris a few minutes ago so 
apologies if this is a breach of etiquette)


Hi, am using Solaris 9. Is there a simple way to crate a tar file 
containing only those files that have changed since a given date (e.g. 
31-may-2008)?

Could you point me to a web site with examples?

We have around 8gb in a compressed tar file generated last weekend.

This file was generated via

cd /usr/topdir
tar -cf mytarfile.tar *

(using pipes to pipe through gzip)

What I would like to be able to do is create another tar file with just 
the files that have changed since a the date on which we made that tar 
file.

Appreciate any pointers.



-- 
jeremy

5.Creating a tar file with only files that have changed since a specified date

In article < XXXX@XXXXX.COM >, Luuk says...
> jeremy schreef:
> > (I did also post this to comp.unix.solaris a few minutes ago so 
> > apologies if this is a breach of etiquette)
> > 
> > 
> > Hi, am using Solaris 9. Is there a simple way to crate a tar file 
> > containing only those files that have changed since a given date (e.g. 
> > 31-may-2008)?
> > 
> > Could you point me to a web site with examples?
> > 
> > We have around 8gb in a compressed tar file generated last weekend.
> > 
> > This file was generated via
> > 
> > cd /usr/topdir
> > tar -cf mytarfile.tar *
> > 
> > (using pipes to pipe through gzip)
> > 
> > What I would like to be able to do is create another tar file with just 
> > the files that have changed since a the date on which we made that tar 
> > file.
> > 
> > Appreciate any pointers.
> > 
> > 
> > 
> 
> find . -mtime -1 -type f -exec ls -l {} \;
> 
> will only list those file that got changed during the last 24 hours...

Thanks - great start for me, really appreciate the help. 

So then I need to take each returned file and place it into a tar file

Something like:

tar -cf fred.tar `find . -mtime -1 -type f -exec ls {} \;`

How do I make the "find" command give me a list of files expressed as 
[path_relative to pwd]/filename ?

e.g. directory structure may be

 dir1/subdirt/filea
 dir2/subdiru/fileb
 dir3/subdirv/filec
 dir4/subdirw/filed
 dir5/subdirx/filee

and I want to place the changed/new files into the tar file retaining 
that directory structure.

Possible?

-- 
jeremy

6. Creating a tar file with only files that have changed since a specified date

7. Creating a tar file with files changed since fixed date

8. Looking for code that can parse C-language declarations to create special data files



Return to linux

 

Who is online

Users browsing this forum: No registered users and 52 guest