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.

5
  • Thank you, this helps a lot. But, I'm getting a line feed before the last file sometimes. 01, fileA, fileB, fileC [LF] 02, fileD [LF] fileE [LF] 03, FileF [LF] and so on. There are no commas in file name either. Commented Nov 17, 2016 at 22:40
  • That sounds strange. It looks as if the ls for directory 02 was run without -m. Do you have an actual example? A file tree that causes this? Commented Nov 17, 2016 at 23:02
  • 1
    Use ls -w0 -m "$d" to avoid hitting the default line length too early Commented Nov 17, 2016 at 23:20
  • Ah, good point! Commented Nov 18, 2016 at 18:56
  • In my version OS ls -w0 caused an error, but I was able to use ls -w99999999. Thanks! Commented Nov 18, 2016 at 22:00