Sponsored Content
Top Forums Shell Programming and Scripting How to rename a file even when it shows permission Denied in Unix Post 302477644 by R0H0N on Monday 6th of December 2010 04:28:56 AM
Old 12-06-2010
If this is not a case of a single file then I would suggest to create your own directory and place all the files in it.

Otherwise you can check if file exists then create your file with some extension.
E.g.

Code:
fileName="name.txt"

if [ -e "$fileName" ] ; then
   file="name_new.txt"   # then create file
else
   touch $fileName    # create file with original name
fi

R0H0N
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Permission denied

Hi, I can not execute a .env file $ . /Data/oracle/d03/mydbora/8.0.6/MYDB.env -bash: /Data/oracle/d03/mydbora/8.0.6/MYDB.env: Permission denied Even if : -rwxrwxrwx 1 oracle dba 2903 Mar 5 2007 /Data/oracle/d03/mydbora/8.0.6/MYDB.env Please help. Many thanks. (1 Reply)
Discussion started by: big123456
1 Replies

2. UNIX for Dummies Questions & Answers

Why do I keep getting .:Permission denied?

I'll start off by saying that I know very little about Unix - however, I do know that I have a .profile file in my home directory, and that I should be able to invoke it by typing . profile. However, when I do this for ANY .filename, I get ".: Permission denied". I'm pretty sure that there is... (12 Replies)
Discussion started by: bbersani
12 Replies

3. Red Hat

Permission denied

Hi guys im new to this db i have a small prob while installing websphereportal6.1i think i was installed succesfully but the error im getting is while starting server. check this out # ./serverStatus.sh -all Error loading: /usr/wps61/AppServer/java/jre/bin/classic/libjvm.so: cannot... (1 Reply)
Discussion started by: varma917989
1 Replies

4. UNIX for Dummies Questions & Answers

Permission Denied creating file under nfs mount

I have two servers, 82 and 70. My exports file on 82 reads / ...70(rw) on 70 I have a mountpoint called mnt_for_82 I execute on 70 mount -t nfs -o rw ...82:/ mnt_for_82 I go to server 70 and indeed can read and travers the mounted subdirectories. However, I try... (0 Replies)
Discussion started by: blaine.miller
0 Replies

5. UNIX for Dummies Questions & Answers

Unable to copy file using SCP (Input/output & Permission denied error)

Hi, I am facing issue while using scp. Source & target machines are Linux & HP-UX respectively. On target machine, if I fire the following command, I get error: Now if I try scp on another file, which is on the same source machine, it works fine. All directories and subdirectories... (2 Replies)
Discussion started by: Technext
2 Replies

6. UNIX for Dummies Questions & Answers

mailx command - Temporary mail file: permission denied

Hi , I am facing a problem with respect to mailx command in unix . Earlier it was working fine and I am facing this issue only from last week . I used mailx command and I am getting a error message as follows : temporary mail file: Permission denied If I run mailx command from... (2 Replies)
Discussion started by: deepav1985
2 Replies

7. Linux

Permission denied

I am using korn shell When I type in Telnet on cmd line, I get message "cannot execute" How can I get permission to execute command ? In which dir is telnet located ? I looked in /usr/bin dir. but its not there Thanks (1 Reply)
Discussion started by: paramshamnani
1 Replies

8. UNIX for Dummies Questions & Answers

Permission denied

when i run echo "User” > /dev/tty5 why do i get permission denied? :confused: (2 Replies)
Discussion started by: chinababy
2 Replies

9. Shell Programming and Scripting

Executing bash file with sudo for the second time, leads to permission denied, for some commands

I have a script that checks if the script has been ran with sudo. If the script is not ran as sudo, the current script is being executed with exec sudo bash. You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies
mvdir(1)						      General Commands Manual							  mvdir(1)

NAME
mvdir - Moves (renames) a directory SYNOPSIS
mvdir directory1 directory2 DESCRIPTION
The mvdir command renames directories within a file system. To use mvdir, you must have write permission to directory1 and directory2 and to the parent directories of directory1 and directory2. The directory1 argument must name an existing directory. If directory2 does not exist, directory1 is moved to directory2. If directory2 exists, directory1 becomes a subdirectory of directory2. directory2 cannot be a subdirectory of directory1. Directories cannot be moved across file systems. You can also rename a directory with the mv command. NOTES
This command was made obsolete by the mv command. EXAMPLES
To rename or move a directory to another location, enter: mvdir appendixes manual If manual does not exist, then this renames the directory appendixes to manual. If a directory named manual already exists, this moves appendixes and its contents to manual/appendixes. In other words, appendixes becomes a subdirectory of manual. SEE ALSO
Commands: mkdir(1), mv(1) Functions: rename(2) mvdir(1)
All times are GMT -4. The time now is 05:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy