Folder name containing ".." on ExFAT: How to rename it? Invisible to ls/mv/Finder but visible to tar/bash
On an ExFAT disk, I have a folder that makes tar
fail:
$ ls -a
. .. paysages scenes de rue
$ tar cf /tmp/f.tar .
tar: ./fruits, legumes,..: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
As you can see, ls
believes that there are only two subfolders, while tar
believes that there is also a folder named fruits, legumes,..
and it chokes on it, presumably because the name contains ..
.
Question: How can I rename fruits, legumes,..
to something safer like fruits
?
What I tried
$ mv fruits\,\ legumes\,.. fruits
mv: rename fruits, legumes,.. to fruits: No such file or directory
By the way, when typing this command I just typed mv fr
then pressed TAB and bash auto-completed to mv fruits\,\ legumes\,..
so bash
also sees that folder but mv
does not see it.
Catalina 10.15.5
You can rename it by using the inode.
First, get the inode of the file (I have a file named test
for this example):
ls -li
8624175 -rw-r--r-- 1 allan staff 0B Jul 15 12:05 test
You will need the very first number in the line - 8624175
Now, using the find
command, rename the file to something else:
find . -inum 8624175 -maxdepth 1 -exec {} mv newname.txt \;