Command to tree list directory structure in Mac OS X

Found this very useful command to recursively list a directory structure in a graphical format in Mac OS X:

find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

It is the equivalent of the tree command in Linux and Windows.

An simple example of the output is below:

|____Test1 (1080P)
| |____Test1 (1080P).mkv
|____Test2 (1080P)
| |____Test2 (1080P).mkv
|____Test3 (1080P)
| |____Test3 (1080P).mkv
|____Test4 (1080P)
| |____Test4 (1080P).mkv

A very useful command on Mac OS X.

Command to change string within folder and file names recursively in Mac OS X

I wanted to rename a whole load of .mkv video files and the folders they were contained within. They all contained the string 1080p and I wanted to change it to 1080P. Notice that the difference is simply the case of the letter P in 1080p, I wanted it to be a capital P. To illustrate this I setup 4 folders; Test1 (1080p), Test2 (1080p), Test3 (1080p) & Test4 (1080p). These folders all contained 1 .mkv file each, also containing the string 1080p. A tree output of the folder structure is below:

|____Test1 (1080p)
| |____Test1 (1080p).mkv
|____Test2 (1080p)
| |____Test2 (1080p).mkv
|____Test3 (1080p)
| |____Test3 (1080p).mkv
|____Test4 (1080p)
| |____Test4 (1080p).mkv

After trying various different commands and failing, I found the answer here. It is the 3rd command on the page by l’L’l:

I changed it according to my needs and ran the command below in the root folder of the folders and files I wanted to rename:

find . -name '*1080p*' | while read f; do mv "$f" “${f//1080p/1080P}"; done

The result was as expected, all folders and files were renamed to contain the string 1080P:

|____Test1 (1080P)
| |____Test1 (1080P).mkv
|____Test2 (1080P)
| |____Test2 (1080P).mkv
|____Test3 (1080P)
| |____Test3 (1080P).mkv
|____Test4 (1080P)
| |____Test4 (1080P).mkv

Be careful when running this command as it will recursively go through all sub-folders and rename anything that matches your string parameters.