Wednesday, April 5, 2017
Unix - Flatten a directory while preserving filenames and adding folder name
the_top_directory_you_want_to_do_this_from$ paste OLD NEW|while read OLD NEW;do mv ${OLD} ${NEW};done
Now remove empty subdirectories:
the_top_directory_you_want_to_do_this_from$ find */ -depth -type d -exec echo rmdir '{}' \;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment