regex - How do I move files based on a certain character length range? -
i have next files in directory:
f.txt fi.txt fil.txt file.txt filen.txt filena.txt filenam.txt filename.txt filenametoolong.txt i want move except lastly one. next regular look applies needs: ^.{1,13}.txt
however, using regex 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 , double checked regex syntax, , seems valid. missing?
mv command doesn't back upwards regex. can utilize find -regex option:
find . -maxdepth 1 -type f -regex '\./.\{1,13\}' -exec mv {} /trashdir + regex linux mv
No comments:
Post a Comment