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?
Asked
Active
Viewed 110 times
0
-
Try using ls -f which doesn't try to sort the files. – user9517 Nov 03 '13 at 11:42
-
1http://serverfault.com/questions/183821/rm-on-a-directory-with-millions-of-files – user9517 Nov 03 '13 at 12:01
-
Try with find . -exec .... – kofemann Nov 03 '13 at 12:13
1 Answers
0
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.
Pedro Côrte-Real
- 11
- 2