I'm trying to rename a file using the regular
mv command which has worked countless times before.
$ ls -l |grep "Picture 001" -rwxrwxrwx 1 rolf rolf 657711 Feb 19 21:42 Picture 001_19.jpg $ mv "Picture 001_19.jpg" "Picture 001_19_u.jpg" mv: cannot move 'Picture 001_19.jpg' to a subdirectory of itself, 'Picture 001_19_u.jpg'
Can anyone tell me why
mv suddenly refuses to rename this file?
mv decided that
Picture 001_19_d.jpg is a directory name, and not a file name?
I tried running the same command with argument
-T, --no-target-directory treat DEST as a normal file
The result are exactly the same.
This is confusing and frustrating!
Is it a bug?
$ mv --version mv (GNU coreutils) 8.30
It does appear to be a bug
$ echo "blah" > tt $ mv tt tt1 mv: cannot move 'tt' to a subdirectory of itself, '../tt' $ mv tt ../ mv: cannot move 'tt' to a subdirectory of itself, '../tt'
The problem happens when I run
mv on a mounted external drive, on a writable NTFS partition.
When I copy it to my Desktop folder, which is hosted on an Ext4 partition and I try
mv there, then it works without problem.
$ sudo apt-show-versions coreutils [sudo] password for rolf: coreutils:amd64/sid 8.30-2 uptodate coreutils:i386 not installed
Indeed I seem to be running a buggy version (as per this answer).