Sample Header Ad - 728x90

Files and directory missing after mv with bash extglob inverse match

1 vote
0 answers
71 views
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?
Asked by analog (11 rep)
May 17, 2023, 07:50 PM
Last activity: May 17, 2023, 07:51 PM