Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • It's not clear what is going on, but shell expansion can't be limited to files: you need to use find or for f in *foo*; do [ -f "$f" ] && mv "$f" foo; done. Please update your question with the results on repeating both tests using ls -F each time and mv -v in both the find ... -exec and the stand-alone command. I'm using Ubuntu 16.04.04 with GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu). If foo is a directory and xyfooz.tex a file, my stand-alone mv gives mv: cannot move 'foo' to a subdirectory of itself, 'foo/foo', which is as expected. What OS are you using?
    – AFH
    Commented Apr 16, 2018 at 1:27
  • I have made edits according to your suggestion, but they don't tell us anything new. I'm using the same bash version, that was already in the question. I would have hoped there existed a regex way to restrict the source to type file.
    – Erwann
    Commented Apr 16, 2018 at 19:00