I have the following files in a directory:
f.txt
fi.txt
fil.txt
file.txt
filen.txt
filena.txt
filenam.txt
filename.txt
filenametoolong.txt
I want to move all except the last one. This following regular expression applies to my needs: ^.{1,13}.txt
However, using the regex with with "mv"
mv ^.{1,13}\.txt trashdir
Results in
mv: cannot stat `^.1.txt': No such file or directory
mv: cannot stat `^.24.txt': No such file or directory
I have checked and double checked the regex syntax, and it seems to be valid. What am I missing?
mv
command doesn't support regex. You can usefind
with-regex
option: