Sponsored Content
Full Discussion: Specify the inode of a file?
Operating Systems Solaris Specify the inode of a file? Post 302894442 by unblockable on Tuesday 25th of March 2014 01:32:30 PM
Old 03-25-2014
Quote:
Originally Posted by bartus11
How is the application getting the inode of a file? Is it done through stat system call?
I'm not sure, I don't work with any of the code unfortunately.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file access inode update

When is a file "accessed" according to UNIX? For example: gzipping a file will not change the access time. (1 Reply)
Discussion started by: dangral
1 Replies

2. Ubuntu

fd.file-max against inode

Hi, If inodes need to be 3-4 times greater than fd.file-max. Can you modify the current inode in the filesystem? Can you modify it on the fly? Or only in the creation of FS. I'm using redhat ent 4. Thank you for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

3. Filesystems, Disks and Memory

Recreating a deleted hardlink to a file if I know the inode number

At risk of twisting the rules to nearly the point of breaking (if you think this goes too far mods, I apologise and accept that this should be deleted), I'm hoping someone might be able to cast a little light on the following problem regarding hard links to files. ... (6 Replies)
Discussion started by: Smiling Dragon
6 Replies

4. Shell Programming and Scripting

Read from file specific place in file using inode

Hello, I am using tcsh on AIX. I would like to write a script that does the following: 1. given an inode, how do I find exactly the name of the file? I know I could do this using ls -i | grep <inode> but it returns: <inode> <filename>. I need some string manipulation or something to... (1 Reply)
Discussion started by: lastZenMaster
1 Replies

5. Shell Programming and Scripting

Modifying a file without changing inode number

Hi all, I am struggling to change the content of a file without changing the inode number. The exact issue is as below. I have a file name test.bak which has 100 lines of text. I am trying to to delete the first 90 lines of the text in the file. I know that using sed/awk/head/tail I can... (3 Replies)
Discussion started by: sathishkmrv
3 Replies

6. Shell Programming and Scripting

changing a file when the inode modified time of the other file changes

i have a requirement where i needed to change variable values in a properties file(first file) whenever there is change to Release details file(second file). My question is do i have to create a daemon process that always checks the modified time/inode change of the second file and then change the... (1 Reply)
Discussion started by: saikiran_1984
1 Replies

7. Red Hat

Inode number changes for a file in Redhat Linux

Hi, I have created a file abc.log in Redhat Linux. Inode number for a file get changes every time i update the file using vi editor. Is there any setting that can be made , such that inode number never gets changed? Or if we cannot restrict from inode number getting changed , is... (9 Replies)
Discussion started by: raghu.amilineni
9 Replies

8. UNIX for Advanced & Expert Users

remove file/inode entry

Hello all, I am on hpux itanium 11.31...and we run a oracle DB on it. I am testing some backup and restore situation.... first i select some data from the DB.....now i remove some files from the DB where my data is being selected from.....now i select the same data from the DB but i still get... (5 Replies)
Discussion started by: abdul.irfan2
5 Replies

9. Solaris

Retreive deleted file name if you having inode number

Some one please help me to find deleted file name, if I am having inode number in Solaris without using any 3rd party tool. Thanks :) (3 Replies)
Discussion started by: aksijain
3 Replies

10. Linux

Inode number changes for a file in Redhat Linux

Hi, I have created a file a.txt in Redhat Linux. Inode number for a file changes every time i update the file using vi editor , gedit etc. Is there any setting that can be made , such that inode number never changes as that is supposed to be the expected behavior? Or if we cannot... (13 Replies)
Discussion started by: srirammanohar
13 Replies
STAT(3) 								 1								   STAT(3)

stat - Gives information about a file

SYNOPSIS
array stat (string $filename) DESCRIPTION
Gathers the statistics of the file named by $filename. If $filename is a symbolic link, statistics are from the file itself, not the sym- link. lstat(3) is identical to stat(3) except it would instead be based off the symlinks status. PARAMETERS
o $filename - Path to the file. RETURN VALUES
stat(3) and fstat(3) result format +--------+--------------------------------------+---+ |Numeric | | | | | | | | | Associative | | | | | | | | Description | | | | | | +--------+--------------------------------------+---+ | 0 | | | | | | | | | dev | | | | | | | | device number | | | | | | | 1 | | | | | | | | | ino | | | | | | | | inode number * | | | | | | | 2 | | | | | | | | | mode | | | | | | | | inode protection mode | | | | | | | 3 | | | | | | | | | nlink | | | | | | | | number of links | | | | | | | 4 | | | | | | | | | uid | | | | | | | | userid of owner * | | | | | | | 5 | | | | | | | | | gid | | | | | | | | groupid of owner * | | | | | | | 6 | | | | | | | | | rdev | | | | | | | | device type, if inode device | | | | | | | 7 | | | | | | | | | size | | | | | | | | size in bytes | | | | | | | 8 | | | | | | | | | atime | | | | | | | | time of last access (Unix timestamp) | | | | | | | 9 | | | | | | | | | mtime | | | | | | | | time of last modification (Unix | | | | timestamp) | | | | | | | 10 | | | | | | | | | ctime | | | | | | | | time of last inode change (Unix | | | | timestamp) | | | | | | | 11 | | | | | | | | | blksize | | | | | | | | blocksize of filesystem IO ** | | | | | | | 12 | | | | | | | | | blocks | | | | | | | | number of 512-byte blocks allocated | | | | ** | | | | | | +--------+--------------------------------------+---+ * On Windows this will always be 0. ** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1. In case of error, stat(3) returns FALSE. Note Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB. ERRORS
/EXCEPTIONS Upon failure, an E_WARNING is emitted. EXAMPLES
Example #1 stat(3) example <?php /* Get file stat */ $stat = stat('C:phpphp.exe'); /* * Print file access time, this is the same * as calling fileatime() */ echo 'Access time: ' . $stat['atime']; /* * Print file modification time, this is the * same as calling filemtime() */ echo 'Modification time: ' . $stat['mtime']; /* Print the device number */ echo 'Device number: ' . $stat['dev']; ?> Example #2 Using stat(3) information together with touch(3) <?php /* Get file stat */ $stat = stat('C:phpphp.exe'); /* Did we failed to get stat information? */ if (!$stat) { echo 'stat() call failed...'; } else { /* * We want the access time to be 1 week * after the current access time. */ $atime = $stat['atime'] + 604800; /* Touch the file */ if (!touch('some_file.txt', time(), $atime)) { echo 'Failed to touch file...'; } else { echo 'touch() returned success...'; } } ?> NOTES
Note Note that time resolution may differ from one file system to another. Note The results of this function are cached. See clearstatcache(3) for more details. Tip As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to "Supported Protocols and Wrappers" to determine which wrappers support stat(3) family of functionality. SEE ALSO
lstat(3), fstat(3), filemtime(3), filegroup(3). PHP Documentation Group STAT(3)
All times are GMT -4. The time now is 06:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy