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.

13
  • Looks like this will do a mv to itself if a file or directory name has no space in it (mv: cannot move a' to a subdirectory of itself, a/a')
    – armandino
    Commented Apr 26, 2010 at 2:50
  • don't matter. just remove the error message by redirecting to /dev/null.
    – ghostdog74
    Commented Apr 26, 2010 at 3:47
  • ghostdog, spawning mv fifty five thousands times only to rename four files may be a bit of overhead even if you don't flood user with messages. Commented Apr 26, 2010 at 10:11
  • krelin, even find will go through those 55000 files you mentioned to find those with spaces and then do the rename. At the back end, its still going through all. If you want, an initial check for spaces before rename will do it .
    – ghostdog74
    Commented Apr 26, 2010 at 10:55
  • I was talking about spawning mv, not going through. Wouldn't for file in *' '* or some such do a better job? Commented Apr 26, 2010 at 11:49