Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

File Manager

Here are examples of file managers you can use for inspiration:

  • FreeCommander: An easy-to-use alternative to the standard windows file manager
  • Explorer++: A lightweight and fast file manager for Windows

Here are resources that you can use to build your file manager:

00:00 File Manager. Most computers will have thousands of files present on them: pictures, videos, text, audio, and other documents. If they’re all placed in a single directory, it would be next to impossible to navigate through and find what you’re after.

00:15 That’s one of the reasons that computers use directories, but we still need to move files and folders around to create some order. File managers are the way to perform this management, allowing users to manage files and directories through a user interface that typically involves a view of the directory structure, as well as files as contained in each directory. Functions such as cut, copy, and paste allow the efficient management of files into their desired structure, and being able to create, delete, and rename files and directories is also necessary. While all of these functions are available to users via the command line, most are not aware of this and will find it difficult to use, so a GUI-based file manager is a much better solution for them for this kind of task.

01:00 Let’s take a look at a couple of file manager implementations for Windows.

01:04 Here, you can see FreeCommander in operation, with two panes open. On the left is the contents of the local C: drive on this particular PC, and on the right, looking in Documents/.

01:18 It’s possible to copy and paste items between. So, for instance, we can copy this file by right-clicking, Copy, and then right-click, and Paste—the kind of file management you’ll be used to operating.

01:31 It’s also possible to view these in different modes. Here, we have list, then details,

01:39 thumbnails, and a toggle button, which takes us between two views. Here, you can see Explorer++ in action with the familiar directory tree on the left, and the contents of the selected directory on the right. It’s possible to select a wide range of views, such as different kinds of icons, a list, details, et cetera,

02:03 and the file manipulations are available via a right-click menu, icons on the toolbar, then the menu here, and also by the familiar keyboard shortcuts.

02:17 Let’s take a look at some of the technical challenges you’ll need to overcome to program your file manager. First—and rather obviously—accessing files. If you’ve programmed these projects in order, you will already have some experience of using these libraries from the previous command-line based projects. Accessing files is, of course, table stakes for a file manager, and these libraries make much of it simple and cross-platform when used appropriately. Secondly, displaying files. You’ll need to decide on a convention for file display. As seen in the examples, it’s possible to have different methods of display—list, icons, details, et cetera—and you’ll need to implement all of this in a manner that allows each item to be selectable from within the user interface. Creation of directories and files.

03:06 Creation of new directories and files is useful, particularly for creating new files with appropriate extensions or metadata to allow them to be edited in the correct application. Copy, cut, and paste.

03:19 You will need to implement these essential functions in a manner which is fail-safe—particularly cut. You don’t want to create a file manager that has a reputation for being a file mangler.

03:31 Now, let’s take a look at some of the extra challenges for the file manager project. First up, search. Many file managers, such as Windows Explorer and the macOS Finder, implement a search function. Adding an advanced search function which uses regular expressions will be a worthwhile challenge.

03:49 Sort. Being able to sort the output of the file manager via filename, file extension, date of creation, or size—whether ascending or descending—is an important addition to our app’s usability.

Become a Member to join the conversation.