Using the Unix/linux system UUID file to intercept the partial generation of random numbers, and in order to prevent the renaming process may already exist and the new random directory with the same name of a sub-directory, that is, the renaming operation is invalid, the MV effect becomes moving the old directory to a sub-directory, deliberately added a heavy loop detection. You can use this script to directly modify all sibling-level subdirectories of the directory in which the script resides.
#!/bin/shfor Dir in $ (find-maxdepth 1-type d | sed ' 1d ') do newdir=$ (Cat/proc/sys/kernel/random/uuid | cksum | cut-f 1-d "") while [-D $NewDir] do newdir=$ (Cat/proc/sys/kernel/random/uuid | Cksum | Cut-f1-d "") Done MV $Dir $NewDirdone
This article is from the "Pine" blog, be sure to keep this source http://dongsong.blog.51cto.com/916653/1653685
Shell randomly renames all current directory-level subdirectories