I have a folder named
akorg✽. That Unicode character causes headaches for me when software makes incorrect assumptions about the text encoding of my file paths, so I'd like to remove it from the name.
You'd think this would be easy:
$ mv akorg✽ akorg mv: cannot move ‘akorg✽’ to a subdirectory of itself, ‘akorg/akorg✽’
but—that's strange—it thinks a folder called
akorg already exists. I'm pretty sure there isn't one:
$ ls -la total 699K drwxr-xr-x 15 ak ak 15 Jun 12 17:34 . drwxr-xr-x 57 ak ak 4.0K Jun 12 17:35 .. drwxr-xr-x 11 ak ak 21 Jun 12 16:58 akorg✽ drwxr-xr-x 2 ak ak 2 May 28 20:47 Desktop ...
stat says otherwise:
$ stat akorg File: ‘akorg’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ...
So apparently there is an invisible folder in the way. Whatever, I'll just remove it:
$ rmdir akorg rmdir: failed to remove ‘akorg’: No such file or directory
Right, then. What in the world is this thing?
What I know so far
- I'm using the stable release of ZFS on Linux. Here's the zpool status and zfs properties.
statreturns the same inode for both
akorg✽. Searching by that inode returns only
$ find . -maxdepth 1 -inum 292128 ./akorg✽
More things that don't work on the "invisible" folder:
$ rm akorg rm: cannot remove ‘akorg’: Is a directory $ unlink akorg unlink: cannot unlink ‘akorg’: Is a directory $ mv akorg akorg_temp mv: cannot move ‘akorg’ to ‘akorg_temp’: No such file or directory
- I get the same results in both Bash 4.2.45 and zsh 5.0.0. In both, tab-completion of
- The strace of my initial renaming attempt confirms that I'm typing the names correctly and that the attempt is thwarted by the preexistence of a folder named
This response to a more explicit renaming attempt is puzzling and scary:
$ mv --verbose --no-target-directory --no-clobber akorg✽ akorg removed ‘akorg✽’
I don't understand why it claims to have removed
akorg✽, or why it would try. Fortunately,
stat akorg akorg✽reveal that nothing is actually gone. Here's the strace.
To rule out encoding quirks as the cause of this, I've temporarily given
akorg✽an intermediate name:
$ mv --verbose --no-target-directory --no-clobber akorg✽ bananas ‘akorg✽’ -> ‘bananas’
That worked as expected,
$ ls -la total 715K drwxr-xr-x 16 ak ak 16 Jun 13 15:11 . drwxr-xr-x 57 ak ak 4.0K Jun 13 14:03 .. drwxr-xr-x 11 ak ak 21 Jun 12 16:58 bananas drwxr-xr-x 2 ak ak 2 May 28 20:47 Desktop ...
but the "invisible" folder is still present:
$ stat bananas akorg File: ‘bananas’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ... File: ‘akorg’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ...
mvstill behaves strangely when I try to use the name
$ mv --verbose --no-target-directory --no-clobber bananas akorg removed ‘bananas’