Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Flatten a directory structure ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Flatten a directory structure
Authored by: excarnate on Mar 01, '13 02:24:14PM

A basic approach would be to locate a folder (e.g. use ls if everything is at the same level, or find /the/path -type f if you wanted to find all subdirectories), parse out its name into 3 parts, YYYY, MM, DD (handling anything like having/not having a leading 0 to suit your needs). mkdir -p /wherever/$YYYY/$MM/$DD Then move or copy or link the files into that directory.

That assumes I understood the question correctly :)



[ Reply to This | # ]