Scott Carnegie Scott Carnegie - 1 month ago 7
Bash Question

Bash Cannot Move File Into Owned Directory

Im having trouble in Bash.

I have plain files in a directory on my desktop. I am trying to move them into a subdirectory within that directory using:

mv "Filename" /"Directoryname"


However when I use this command, I get an error telling me that the permission was denied.

I am set as the owner of both directories and have should have full permissions. If there is anything I need to provide you to make it easier for you to help me, I will be glad to help.

Answer

Try mv filename subDirectoryName/.

By placing / in front of the directory name in a move sequence, you're telling the shell that you would like it to be placed in a high level folder named /folder.

What you want is a sub-directory within your current directory. As you would usually move directories in bash, ../ goes up one directory, and directory/ implies you are moving into a folder that is within your current directory.