LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2003, 04:22 PM   #1
Ian Knight
LQ Newbie
 
Registered: May 2003
Posts: 1

Rep: Reputation: 0
How to set file creation time in Linux


Hello,

I’m new to Linux (Redhat) and just started C programming on it today, however I do have many year of C on other platforms.

What I’m writing is a file copy utility that will recures down a directory tree and copy files into a single directory. However, I when I create/open the new file to write in, I wish to preserve the file creation time of the original file. Now I have found the utime() function that will allow me to change the access and modified times but can’t find a function to set the file creation time… Can you help please.

Brgds Ian Knight

ian@eqmc2.fsnet.co.uk
 
Old 05-06-2003, 05:47 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I'd recommend grabbing the source for
GNU fileutils and have a close look at
cp.c ... because if used with the -p
flag it manages to copy a file and preserve
the creation time :)

Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: how to get time (in seconds) elapsed since creation of a file? J_Szucs Linux - General 6 12-27-2008 11:28 PM
list file creation time allelopath Linux - General 2 08-02-2005 09:02 PM
Set time in linux jasone Linux - General 2 05-24-2005 01:44 AM
How to set default file creation pembo13 Linux - Security 6 07-02-2004 10:44 PM
Time of creation of a file proxyserver Linux - Software 2 04-11-2004 10:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration