Attempted to move all files and directories not ending with .srt to the parent directory by using these commands:

shopt -s extglob
mv !(*.srt) ..

Checked dir contents with ls and everything looked correct, only .srt files remaining:

abc.srt xyz.srt 123.srt etc.srt

When I went up a directory to check the contents, the sub-directory I was just in was not there and only about half the files were moved to the parent directory. mv threw no errors during the operation.

I've tried recursively searching for the missing directory from the root of my system (fd -H 'missingfile' /) but nothing is showing up.

What happened to my files? Did the pattern matching result in renaming and overwriting instead of the intended move?

  • Strange, can't reproduce that, everything works fine for me
    – xezo360hye
    May 24 at 15:27
  • I don't see any potential side-effect of this glob substitution that would do what you say, there is no string transformation nor recursive globbing that could have generated name collision. My first feeeling is that you follow a red herring. The hypothesis is too speculative and we have too few elements to help you or prove anything May 28 at 18:03
  • Did the moved files include directories and/or symbolic links?
    – Kusalananda
    Aug 29 at 17:48


You must log in to answer this question.

Browse other questions tagged .