I setup a motion detection software on linux and in the process created a directory with so many jpg files in it that running "ls mydirectory" just hangs. How can I split the content into several subdirectories when I can't even get a listing of what's inside?


1 Answer 1


Iain's suggestion is the solution. My plan was to get a listing that I could then use to move files into multiple folders. When I tried to do a "ls -1", ls failed after exausting the server's memory. When I instead did "ls -1f" it worked fine, so the problem here is that ls by default buffers the whole directory contents to then sort them.

I now have a listing of all the files and have a script running moving the individual files into a multi-folder hierarchy that should fix this properly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .