Join David Gassner for an in-depth discussion in this video Managing files and directories, part of Advanced Java Programming.
In Java 7, once you know how to use the Path class to point to a directory or a file, it's…another simple step to start managing those files to be able to copy, delete, and move them around.…To do this, you use a class called files, the second major part of this new package.…I'm working in a project where I have a file called loremibsom.txt, and it's stored within…a files folder, within the project.…And within my main code I've created a Path Object called source that points to that file…using a relative location.…
This string should work exactly the same regardless of whether you are working on Mac or Windows.…I'm getting a reference to the file and then outputting the file name, I'll run the code,…and I'll see the output file name in the console.…Now, I'm going to show how to copy and how to delete files.…Before I do this with code, I'm going to make a copy of the files, so just in case I mess…up, I'll be able to restore it.…So I'll copy and paste it, and I'll name the new file backup.txt.…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- 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.