commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
If you have a folder with thousand of files and want to have many folder with only 100 file per folder, run this.
It will create 0/,1/ etc and put 100 file inside each one.
But find will return true even if it don't find anything ...
There are 3 alternatives - vote for the best!
Take a folder full of files and split it into smaller folders containing a maximum number of files. In this case, 100 files per directory.
find creates the list of files
xargs breaks up the list into groups of 100
for each group, create a directory and copy in the files
Note: This command won't work if there is whitespace in the filenames (but then again, neither do the alternative commands :-)
If you can do better, submit your command here.
You must be signed in to comment.