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: adrianm on Feb 26, '13 09:58:19AM

You can do it in Finder too.

Just make a query such as Name matches "" in the directory where you want to start looking and it'll find everything.

So, in a Finder window, type Cmd+F and you end up with the search criteria bar showing Kind is Any.
Change that to Name matches "" (empty double quotes).

That's it. Do what you will with the files.

---
~/.sig: not found



[ Reply to This | # ]
Flatten a directory structure
Authored by: macher on Feb 27, '13 04:46:05AM
I am curious could something like exporting folders with names like year-month-date into a structure like year/month/data/datahere be possible and how.
---
I have my life with me but my heart is at home.


[ Reply to This | # ]
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 | # ]
Flatten a directory structure
Authored by: Rishifter on Feb 27, '13 09:39:07AM

Exactly what I've done many times. I think this has something to do with Finder, by default as far as I can remember, not searching the current directory and instead searching the entire mac. That setting is found in Finder Preferences > Advanced > "When performing a search". I always keep it to "Search the current folder" and when that is set just searching in any Finder window searches that folder which then makes it simple to search for all files.

It is interesting to know there are multiple ways of doing things like the terminal command in the original hint or as I was thinking of AppleScript someone already posted a script to do just that. But I always believe the easiest way is the best way, which in this case is in spotlight in Finder already. The terminal and AppleScript of course have their advantage in automating those things.



[ Reply to This | # ]