Welcome to WebmasterWorld Guest from 35.172.100.232

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Need to know about fileatime, filectime and filemtime

     
8:29 am on Nov 14, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 12, 2003
posts:55
votes: 0


Hi all, I'm trying to create a little file management application, and have managed to do quite a bit, but when displaying the files I want to have a "file created"-notification.

However, I can't seem to make sense of the three functions that I can use. This is what they do according to php.net:

fileatime - show last time file was accessed
filectime - show last time file was changed
filemtime - show last time file was modified

To my limited file knowledge I can't seem to understand which would show the create date. Any ideas?

Also, can someone tell me the difference between a file being changed and a file being modified?

Thanks.

1:27 pm on Nov 14, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 12, 2003
posts:55
votes: 0


I would also like to know something about file permissions on Windows. I'm trying to make a directory with mkdir("path", mode) command, but I get a permission denied.

Does anyone know how this can be fixed?

Thanks again :)

1:47 pm on Nov 14, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


fileatime
The atime of a file is supposed to change whenever the data blocks of a file are being read. This can be costly performancewise when an application regularly accesses a very large number of files or directories. Some Unix filesystems can be mounted with atime updates disabled to increase the performance of such applications; USENET news spools are a common example. On such filesystems this function will be useless.
filectime
In most Unix filesystems, a file is considered changed when its inode data is changed; that is, when the permissions, owner, group, or other metadata from the inode is updated. Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There is no creation time for Unix files in most Unix filesystems.
filemtime
This function returns the time when the data blocks of a file were being written to, that is, the time when the content of the file was changed.


To my limited file knowledge I can't seem to understand which would show the create date. Any ideas?

Doesn't look like you are going to be able to show the create date on a UNIX filesystem. Looking closer at the statement in the filectime function, we notice that "there is no creation time for Unix files in most Unix filesystems." I guess a workaround for this would be to create a separate file that stores your filenames and the date/time they were created.

On a Windows platform (or AS400, etc. that does store file creation information) you could execute commands [us3.php.net] on the system itself and return the information you want.

Also, can someone tell me the difference between a file being changed and a file being modified?

On a very basic level, changed refers to the file "defintion" whereas modified refers to the "contents" of the file.

1:52 pm on Nov 14, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


I'm trying to make a directory with mkdir("path", mode) command, but I get a permission denied.
Does anyone know how this can be fixed?

The user you are running as must have the correct permissions for the current directory in which you are trying to make the new directory.

2:12 pm on Nov 14, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 12, 2003
posts:55
votes: 0


Thanks a lot for all the help. Great answers.

> The user you are running as must have the correct
> permissions for the current directory in which you are
> trying to make the new directory.

That's what I figured, but I can't seem to change any permission settings for the current directory. Do you know how this can be done on Windows XP? I seem to have tried everything (properties, chmod), but nothing seems to work.

Thanks...

1:04 pm on Nov 20, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


I don't, but maybe this bump will get you some help ;)
11:52 am on Nov 26, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 12, 2003
posts:55
votes: 0


I think I figured out what needed to be done. The permissions that I had problems with was in the actual destination directory, which I though were where it should be, but it seemed like the permissions had to be changed in the directory where the script runs as well.
So I have made it work.

Thanks to everyone for the help...

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members