I have this situation where I want to exclude a directory while using the mv
command. I saw this example where the syntax would be !(exclude_dir)
, but when I set up a scenario to test it I get results that I don't fully understand.
Now I have created three folders: f1
,f2
and f3
. Now I use the command in this way:
mv -t f3/ !(f1) f2
This produces this error:
mv: cannot move 'f3' to a subdirectory of itself, 'f3/f3'
mv: cannot stat 'f2': No such file or directory
Now funny thing is the structure of the folder is now:
.
├── f1
└── f3
└── f2
3 directories, 0 files
It does what I want but why the error messages. Obviously I am not using that command correctly.