10-20-2007
PRIVATE is the path to the directory you want to affect.
find will enumerate through the files
dirname gets the directory name
basename gets the name without the directory
mv does the rename
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi I have just a few questions about the Unix aka NIX operating system.
1. Is it a free Operating System and if so where can I obtain it.
2. Where can I start out for a newbies guide to the OS.
Thanks (1 Reply)
Discussion started by: SolidWing68
1 Replies
2. UNIX for Dummies Questions & Answers
1. Someone pings a server from another location and gets a different result than if you ping the same server onsite. What is going on?
2. You know the reason the server won't boot is because of ODS, but the root partition isn't on ODS. How do you go about fixing it?
3. How would you truncate... (1 Reply)
Discussion started by: JoeTheMan
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
Im trying to send a .ZIP file in an email message using mail or mailx. What is the easiest way to do this?
Thanks!
UPDATE: I used the following command which didnt work
mailx -s {my subject} {xxxxx@ssss.com} < /var/tmp/file.zip (3 Replies)
Discussion started by: lewisoco
3 Replies
4. UNIX for Dummies Questions & Answers
1) Can a script be made to ignore all signals.
2) Does the parent process always picks up the exit status of its children.
3) Can one program give rise to multiple processes.
4) Is a file is synonymous with a process.
5) Is the kill command only used to kill a running process. (1 Reply)
Discussion started by: yahoo14
1 Replies
5. What is on Your Mind?
Hello all.
Im a young lad with very limited experience with computers, even though I have been playing with them the past 5 years. I have the experience of the random World of Warcraft player that plays games all day.
I have a huge interest in learning everything about computers and I was... (5 Replies)
Discussion started by: Vallzi
5 Replies
6. SCO
Dear friends
I'm really new comer to this place and to this subject
you will make me so happy if you help me about these questions:
1- I must install UNIX 5.0.6 because one of my work software will works ONLY on this version , so , I want to know WHERE CAN I DOWNLOAD A COMPELETE PACKAGE OF... (2 Replies)
Discussion started by: mrr53
2 Replies
7. UNIX for Dummies Questions & Answers
Hi
I got asked over the phone for interview
can anyone answer the following
#1 What is the command to copy files from 1 Unix machine to another Unix machine, providing that the 2 machines are in the same network.
I think its cp, what is the one machine to another machine thing
#2... (4 Replies)
Discussion started by: ccp
4 Replies
8. Shell Programming and Scripting
Hello,
Hello,
Can any one tell me the answer of these questions attached in the document.
The competition was over and I wanted to know correct answers. (6 Replies)
Discussion started by: bits1904
6 Replies
9. Homework & Coursework Questions
I need help for the following questions:
1. What are the advantages and disadvantages of using ACLs versus ordinary Unix file permissions?
2. Describe three methods for automating system administration tasks. Discuss the time taken to do things manually versus creating automatic systems.... (3 Replies)
Discussion started by: ravian97
3 Replies
LEARN ABOUT REDHAT
basename
DIRNAME(3) Linux Programmer's Manual DIRNAME(3)
NAME
dirname, basename - Parse pathname components
SYNOPSIS
#include <libgen.h>
char *dirname(char *path);
char *basename(char *path);
DESCRIPTION
The functions dirname and basename break a null-terminated pathname string into directory and filename components. In the usual case,
dirname returns the string up to, but not including, the final '/', and basename returns the component following the final '/'. Trailing
'/' characters are not counted as part of the pathname.
If path does not contain a slash, dirname returns the string "." while basename returns a copy of path. If path is the string "/", then
both dirname and basename return the string "/". If path is a NULL pointer or points to an empty string, then both dirname and basename
return the string ".".
Concatenating the string returned by dirname, a "/", and the string returned by basename yields a complete pathname.
Both dirname and basename may modify the contents of path, so if you need to preserve the pathname string, copies should be passed to these
functions. Furthermore, dirname and basename may return pointers to statically allocated memory which may be overwritten by subsequent
calls.
The following list of examples (taken from SUSv2) shows the strings returned by dirname and basename for different paths:
path dirname basename
"/usr/lib" "/usr" "lib"
"/usr/" "/" "usr"
"usr" "." "usr"
"/" "/" "/"
"." "." "."
".." "." ".."
EXAMPLE
char *dirc, *basec, *bname, *dname;
char *path = "/etc/passwd";
dirc = strdup(path);
basec = strdup(path);
dname = dirname(dirc);
bname = basename(basec);
printf("dirname=%s, basename=%s
", dname, bname);
free(dirc);
free(basec);
RETURN VALUE
Both dirname and basename return pointers to null-terminated strings.
BUGS
In versions of glibc up to and including 2.2.1, dirname does not correctly handle pathnames with trailing '/' characters, and generates a
segmentation violation if given a NULL argument.
CONFORMING TO
SUSv2
SEE ALSO
dirname(1), basename(1),
GNU
2000-12-14 DIRNAME(3)