Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've never had this problem before, but for some reason, I can't rename my folder to packages/.

This is the structure:

root
  -  packages_old/
  -  packages

When I try to rename the folder with Thunar, I get an error message saying that the file already exists. Same with mv:

blender iso $ mv packages_old/ packages/
mv: accessing `packages/': Not a directory

Why am I unable to rename my file and folder to have the same name:

root
  -  packages/
  -  packages

I swear I've done this before.

share|improve this question
12  
Your memory is probably not as foolproof as you think it is. In the unix platform "everything is a file". You cannot have a file and folder with the same name because directories are just a special kind of file. It's related to the traditional .d extensions on directories in /etc. Suppose you did ls packages or vim packages -- how would the system know if you wanted the directory or the file? –  jw013 Oct 11 '11 at 21:53
1  
Could you maybe tell us what OS you're using? Because you cannot have a file and a directory have the same name on most OS I know –  rahmu Oct 11 '11 at 21:56
2  
@j013, why have you answered in a comment and not wrote an answer? –  andcoz Oct 11 '11 at 21:58
    
@rahmu: Well, what about Windows? –  Blender Oct 11 '11 at 22:16
4  
In Windows, the default settings is to ignore extensions, so you could have a package directory and a package.txt file in the same folder. From Windows Explorer, it will appear that you have to entries called "package", when in fact, it is just hiding part of the filename of one. –  Arcege Oct 12 '11 at 0:48

1 Answer 1

up vote 17 down vote accepted

In Unix, almost everything is a file. A directory is a special type of file that from the user's perspective can "contain" other files.

The error Not a directory occurs because your existing file is not a directory, and since a directory is a type of file, and there cannot be two identically named files in one directory, the operation cannot be performed.

share|improve this answer
2  
As for your memory problem, maybe in the past your file and directory had the same name but with different case, like "package" and "Package". File names are case-sensitive, so that would work. –  noamtm Oct 16 '11 at 10:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.