Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract directory path from a parameter Post 303042856 by wtolentino on Wednesday 8th of January 2020 01:00:40 PM
Old 01-08-2020
that works thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to find the path of a file when it is passed as ....filename(parameter) to script

hi unix guru's..................:confused: question is posted in the #3 permalink shown below. (3 Replies)
Discussion started by: yahoo!
3 Replies

2. Shell Programming and Scripting

Extract directory from a file path

Im trying to extract a directory from a path entered by the user Lets say the path is path=/home/bliss/files/myfile.txt i wanna extract "/home/bliss/files" from $path ... how can i do this? (4 Replies)
Discussion started by: mrudula009
4 Replies

3. Shell Programming and Scripting

Extract path within path

Hi, I have a environmental variables, ORACLE_HOME=/u01/oracle/ORCL/db/tech/10.2.0 ORACLE_SID=ORCL Now I need to create a variable and need to extract some part from ORACLE_HOME. I need to get the path from ORACLE_HOME till ORACLE_SID as /u01/oracle/ORCL. I may need to check also... (6 Replies)
Discussion started by: sreejitnair123
6 Replies

4. Shell Programming and Scripting

one liner to extract path from PATH variable

Hi, Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable? for eg: suppose the PATH is being set as follows PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4 ... (2 Replies)
Discussion started by: royalibrahim
2 Replies

5. Shell Programming and Scripting

How to extract and replace with parameter value?

Hi, I have a function getparam() which takes parameter name as input and parameter value as output. I have a strting like this, abcd#paramname1#efgh#paramname2#ijklmnopq Above one is my input, The strting enclosed in # are the parameter names. Here question is, I have to get the... (0 Replies)
Discussion started by: anandapani
0 Replies

6. Shell Programming and Scripting

Retrieve directory path from full file path through sh

Hi, I have a file abcd.txt which has contents in the form of full path file names i.e. $home> vi abcd.txt /a/b/c/r1.txt /q/w/e/r2.txt /z/x/c/r3.txt Now I want to retrieve only the directory path name for each row i.e /a/b/c/ /q/w/e/ How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies

7. Shell Programming and Scripting

How to extract strings from full path when full path is not fixed

/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies

8. UNIX for Dummies Questions & Answers

Extract directory name from the full directory path in UNIX using shell scripting

My input is as below : /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt /splunk/scrubbed/triumph/ifind.triumph.txt From the above input I want to extract the file names only . Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies

9. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

10. UNIX for Beginners Questions & Answers

What is the difference ../directory path and ./directory path in ksh?

What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
rmdir(2)							System Calls Manual							  rmdir(2)

NAME
rmdir - Removes a directory file SYNOPSIS
#include <unistd.h> int rmdir ( const char *path ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: rmdir(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the directory pathname. The final component of the path parameter cannot be a symbolic link. DESCRIPTION
The rmdir() function removes the directory specified by the path parameter. The directory is removed only if it is an empty directory. For the rmdir() function to execute successfully, the calling process must have write access to the parent directory of the path parameter with respect to all of the system's access control policies. If the directory's link count becomes 0 (zero) and no process has the directory open, the space occupied by the directory is freed and the directory is no longer accessible. If one or more processes have the directory open when the last link is removed, the . (dot) and .. (dot-dot) entries, if present, are removed before the rmdir() function returns, and no new entries may be created in the directory. How- ever, the directory is not removed until all references to the directory have been closed. Upon successful completion, the rmdir() function marks the st_ctime and st_mtime fields of the parent directory for update. RETURN VALUES
Upon successful completion, the rmdir() function returns a value of 0 (zero). If the rmdir() function fails, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the rmdir() function fails, the directory is not deleted and errno may be set to one of the following values: Search permission is denied on a component of the path parameter, or write permission is denied on the parent directory of the directory to be removed. The process does not have write access to the parent directory with respect to one of the system's access control policies. The directory is in use as either the mount point for a file system or the current directory of the process that issued the rmdir() function. The directory named by the path parameter is not empty. The path parameter is an invalid address. While reading from or writing to the file system, an I/O error occurred. Too many links were encountered in translating path. The length of the path parameter exceeds PATH_MAX, or a pathname component is longer than NAME_MAX. The directory named by the path parameter does not exist or is an empty string. A component of the path parameter is not a directory. The S_ISVTX flag is set on the parent directory of the directory to be removed, and the caller is not the file owner. The directory named by the path parameter resides on a read-only file system. [Tru64 UNIX] For NFS file access, if the rmdir() function fails, errno may also be set to one of the following values: The file position pointer associated with the filedes parameter was negative. Indicates either that the system file table is full, or that there are too many files currently open in the system. Indicates a stale NFS file handle. An opened file was deleted by the server or another client; a client cannot open a file because the server has unmounted or unexported the remote directory; or the directory that contains an opened file was either unmounted or unexported by the server. RELATED INFORMATION
Functions: chmod(2), mkdir(2), mknod(2), rename(2), umask(2), unlink(2), mkfifo(3), remove(3) Standards: standards(5) delim off rmdir(2)
All times are GMT -4. The time now is 10:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy