Cannot move a file on Unix

Posted on 2013-05-20
Last Modified: 2013-05-21
I am trying to move a file into a subdirectory:

mv myfile.txt /MyDir

and getting an error:

mv: /MyDir: The file access permissions do not allow the specified action

The permissions are as follows:

drwxr-xr-x    2 oracle   dba             256 May 20 16:23 MyDir
-rwxr--r--    1 oracle   dba      14327181312 May 20 16:32 myfile.txt
Question by:YZlat
LVL 84

Expert Comment

ID: 39182591
are you oracle?
LVL 14

Expert Comment

ID: 39182596
On the off chance this is an easy one, are you logging in as the user oracle? Have you tried using sudo?
LVL 76

Expert Comment

ID: 39182906
Run who
ls -l myfile.txt
getfacl myfile.txt
The issue might be you do not have rights on myfile.txt.

Try cp first?

An mv is a copy and delete the original.
LVL 84

Expert Comment

ID: 39183027
you might also check ls -ld .
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

LVL 76

Expert Comment

ID: 39183271
df -k
Is /MyDir its own partition?

Wait a second, why are you using /MyDir?

mv myfile.txt MyDir
LVL 84

Accepted Solution

ozo earned 150 total points
ID: 39183413
If you really meant a subdirectory,  /MyDir might be considered more of a top level directory, unless you are considering it a subdirectory of /
But / seems a strange place to put myfile.txt
Or maybe that's why you want to move it.
LVL 35

Author Closing Comment

ID: 39184108
LVL 84

Expert Comment

ID: 39184130
arnold was the first to suggest that you might not have meant to move the file to /MyDir

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now