Sponsored Content
Top Forums Shell Programming and Scripting Gather File permission during scripting on unix as numbers. Post 302227907 by jim mcnamara on Friday 22nd of August 2008 07:28:04 AM
Old 08-22-2008
do you mean set file permissions to 755?
[code]chmod 755 filename[/url]

If you mean get the permissions, and you are in Linux check out the stat command. That would be
Code:
man 1 stat 
#or
stat --help

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scripting file permission problems...

Hello all - I have two systems. 1) Linux box running Redhat 8.0 2) Tru64 box running V4.0f From the Linux box I am remotely mounting a directory (nfs mount) that resides on the Tru64 machine. The directory that is nfs mounted contains two subdirectories: my_dir1 my_dir2 I want... (3 Replies)
Discussion started by: Heron
3 Replies

2. Shell Programming and Scripting

How to create file in ksh scripting with permission(rw-rw-rw)

Hi, Please provide your inputs.. Thanks in Advance, Mansa (1 Reply)
Discussion started by: mansa
1 Replies

3. UNIX for Advanced & Expert Users

UNIX file Permission

I am trying to FTP files from windows to UNIX (IBM AIX). After having sent the files to unix server. Permisssion of the files becomes 640 (rw-r-----). I have to manually login to unix and do chmod 644 on the folder to give it permission. Is it possible that the files automaically be set to 644 on... (2 Replies)
Discussion started by: puspendu.das.in
2 Replies

4. Shell Programming and Scripting

How to create a file with full permission in unix script

In my script, I am creating a file ----> then writting one line (i.e. Timestamp) ----> then FTP'ing. The same script can be executed by many other users. While other users executing this script, they couldn't Over write this one line (i.e. Timestamp) My expectation So I wanted to create a... (2 Replies)
Discussion started by: sbmk_design
2 Replies

5. Shell Programming and Scripting

How to rename a file even when it shows permission Denied in Unix

While executing a script, I am not being able to able to create a file as the file with the same name already exists. That existing file is not getting overwritten as I am not the owner of the file. So, Neither am I able to rename the file nor delete the existing file, so as to get my file created.... (2 Replies)
Discussion started by: Haimanti
2 Replies

6. UNIX for Dummies Questions & Answers

Simple question on unix file permission

As I understand the file permissions in UNIX is basically Owner, group, others Lets assume scott user who's primary group is dev creates a file called test.dat and then grants some privileges on that file... scott@unix-host> echo "this is a test" > test.dat scott@unix-host> chmod 640... (4 Replies)
Discussion started by: luft
4 Replies

7. UNIX for Dummies Questions & Answers

How to find out who changed the file permission in unix

Can any one tell me is there any command to find out who changed the permission of a file Or is there any log file so that i can find out who has changed the permission of a file? Thanks in Advance:) (7 Replies)
Discussion started by: Uttamnsd
7 Replies

8. UNIX for Dummies Questions & Answers

Change unix permission when I don't own the file

Hi, A file is transferred from a Windows server(say username : user1) to Unix server via ftp. In unix, the permission of the file for a user, say user2 will be "-rw-r-----". Since the user1 is the owner of the file, user2 is not able to change the file permission using chmod. Is there... (5 Replies)
Discussion started by: merin
5 Replies

9. UNIX for Dummies Questions & Answers

How can I use my code to gather information from a file in a completely different directory?

I need my code to compare two different files that are in two completely different directories, How can I do this? So for example, my code will look at file1 which is in my home directory, and compare the files with those from file2 that is in /abc/adf/adr/afc/adf/file2... does that make sense? (1 Reply)
Discussion started by: castrojc
1 Replies

10. Shell Programming and Scripting

Script to Gather data from logs and export to a CSV file

Greetings, After a few hours of trial and error, I decide to ask for some help. I am new to AWK and shell script, so please don't laugh :p I made the below script, to gather data from some logs and have the output into a CSV file : #!/bin/sh #Script to collect Errors ... (9 Replies)
Discussion started by: Yagami_Sama
9 Replies
STAT(2) 							System Calls Manual							   STAT(2)

NAME
stat, fstat - get file status SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> stat(name, buf) char *name; struct stat *buf; fstat(fildes, buf) struct stat *buf; DESCRIPTION
Stat obtains detailed information about a named file. Fstat obtains the same information about an open file known by the file descriptor from a successful open, creat, dup or pipe(2) call. Name points to a null-terminated string naming a file; buf is the address of a buffer into which information is placed concerning the file. It is unnecessary to have any permissions at all with respect to the file, but all directories leading to the file must be searchable. The layout of the structure pointed to by buf as defined in <stat.h> is given below. St_mode is encoded according to the `#define' statements. The mode bits 0000070 and 0000007 encode group and others permissions (see chmod(2)). The defined types, ino_t, off_t, time_t, name vari- ous width integer values; dev_t encodes major and minor device numbers; their exact definitions are in the include file <sys/types.h> (see types(5). When fildes is associated with a pipe, fstat reports an ordinary file with restricted permissions. The size is the number of bytes queued in the pipe. st_atime is the file was last read. For reasons of efficiency, it is not set when a directory is searched, although this would be more logical. st_mtime is the time the file was last written or created. It is not set by changes of owner, group, link count, or mode. st_ctime is set both both by writing and changing the i-node. SEE ALSO
ls(1), filsys(5) DIAGNOSTICS
Zero is returned if a status is available; -1 if the file cannot be found. ASSEMBLER
(stat = 18.) sys stat; name; buf (fstat = 28.) (file descriptor in r0) sys fstat; buf STAT(2)
All times are GMT -4. The time now is 05:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy