Join Todd McLeod for an in-depth discussion in this video Useful applications of directory recursion, part of Code Clinic: Go.
- Alright, so we have our solution…for this code clinic challenge…and one of the main takeaways from this challenge…is being able to work with directories…and recursively go through directory structure…and find the files in it…and then do something with the file,…and along those lines,…I just wanted to share with you…how can you append text to a bunch of files…and how can you rename a bunch of files?…So that's just something I find really useful…and I wanted to pass it along.…So the first thing to do is get all the files…and I just put this in as a test…and if you run this, it prints out…all the files from right there.…
So I'm just kind of going through this…in a methodical way to make sure that…I don't accidentally rename or overwrite…files I don't want renamed or overwritten.…Or append text to something I don't want to…the text appended to.…So I just sort of check that right there…and then the next thing I do is I do a test…of appending this text to these files…and I have the files before text is appended to them…
Todd introduces challenges and then provides overviews of his solutions in Go. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Skill Level Beginner
1. Problem 1—Exploring Lake Pend Oreille
2. Problem 2—Image Analysis
3. Problem 3—Eight Queens
4. Problem 4—Accessing Peripherals
5. Problem 5—Recursion and Directories
6. Problem 6—Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.