How to Save a File

Share

Saving a file is a basic computer operation. You can save a file in all kinds of applications, and the process to do it is generally the same no matter which program you use. In this article, we'll learn how to save files and how this process works.

Save, Save as, Save a copy, and Export

The general process for saving a file in an application starts with clicking on the "File" menu in the menubar and choosing an option such as "Save," "Save as...,""Save a copy...," or "Export...." Different applications have different options to choose from. They work as follows:

Clicking "File -> Save" will save the file by overwriting the file that is currently opened. If no file is currently opened, it will show a dialog to choose where the file should be saved. We'll see how this works exactly further below.

Clicking "File -> Save as..." will always show a dialog to choose where the file should be saved, and never overwrite by default.

Clicking "File -> Save a copy..." shows a dialog to choose where to save a copy. There's a difference between this and "Save as..." that we'll understand below.

Clicking "File -> Export..." shows a dialog to choose where to save the exported file.

From this we can understand that in most cases saving a file means a dialog to save the file is going to appear. We'll see how this dialog works further below as well.

How are Files Saved?

In order to save a file, a computer program needs to know where the file should be saved. This location of the file, or address, is called its filepath. All files in your computer have a filepath, and two different files always have two different filepaths.

A file a piece of data identified by a filepath. Files are typically saved in hard disks or SSDs. When a program saves a file, what it's doing is telling the operating system (e.g. Windows) to save a piece of data in a certain location identified by the filepath. The operating system is responsible for figuring out where that filepath actually leads to.

For example, in Windows, if a filepath starts with C:\, that means it's the same drive where Windows is installed. If Windows is installed in a SSD, then a file saved in C:\something is going to be data stored inside a SSD device inside your computer. If Windows is installed in a hard disk, then it's going to be inside a hard disk. The operating system is responsible for handling these details.

Because every single file has a different filepath, if you try to save a file using a filepath that is already associated with an existing file, the old file will need to be deleted. This process is called overwriting a file. Quite literally, whenever we overwrite a file, we're deleting the file and creating a new file in its place, in the same folder, with the same filename, with the same filepath.

Overwriting deletes the old file, which means that if we don't want to lose the old file, we should never overwrite it.

As we've seen above, clicking File -> Save will overwrite a file if it's already open in an application.

Most applications that are capable of editing files can work in two scenarios:

  1. When you're editing a file that you opened in it.
  2. When you're editing a new file that you haven't saved yet.

In the second case, the title of the window will probably read "Untitled," meaning that the "file" that is currently open has no title yet because it has never been saved. When we save the file, or when we open a previously saved file, the title of the window will change to show the filename of the file currently open.

For example, if open Microsoft Paint, by default it lets us edit a new file, which is a blank canvas. If we click File -> Save in this scenario, Paint will show us a dialog so we can select where to save the file. After we save the file, Paint will start working as if we had opened the file that we just saved. The next time we click File -> Save it won't ask where to save the file, it will just save in the same place that it was saved before, in the same filepath, overwriting it.

This overwriting behavior is generally not a problem, and you can click File -> Save without worrying about it. However, for applications that edit images, like Paint, it's actually dangerous. That's because if you open a photo with Paint, crop it, and click save, it will have permanently cropped your photo: the cropped area will have been deleted, lost forever. In these cases, you should use File -> Save as... instead to avoid overwriting your original file.

The behavior of File -> Save a copy... is similar to File -> Save as... with one exception. Save as... changes the filepath currently open in the application, while Save a copy... does not. For example, if we opened the file C:\old-file and then we used Save as to saved it as C:\new-file, the next time we click File -> Save the program will overwrite C:\new-file. However, if we used Save a copy..., then File -> Save will overwrite C:\old-file, because the filepath that the application thinks it's editing currently wouldn't have changed.

As for File -> Export..., this works in a manner similar to Save a copy, but it's used by applications that have a custom file format for project files and a different file format for publishing files. For example, advanced image editors typically support things like layers that common image formats like JPG do not support. Because of this, when you save your project with layers it's saved in the project format, and in order to use that image in practice it needs to be exported to a common format.

The File Picker Dialog

The dialog box used to save files, also called a file picker, varies from application to application, although there are some common properties.

First, there's usually a "Save" button and a "Cancel" button. Clicking "Cancel" cancels saving the file, and you can go back to editing. You should click "Save" after you have chosen where to save the file.

To choose where to save the file first you need to navigate to the folder where you want to save it. The file picker shows the contents of a folder in its main area. There's typically a sidebar with common locations of your computer, such as your Documents folder. Clicking on it will reveal the contents of the Documents folder in the main area. Then you could save the file there, or you could double click on a folder inside the main area to navigate to inside of it.

After finding the appropriate folder where to save the file, you need to type its filename.

Two files inside a same folder can't have the same filename. In some cases, it may seem like they have the same name on Windows because Windows hides a part of the file name called the file extension by default.

On Windows, the file picker normally has a second field under the "File name" field where you can select a type for the file, e.g. "PNG (*.png)." This *.png shows the file extension of the file.

Typically, if you type a file name without an extension, e.g. my-file, the application will automatically add the default extension to the filename.

For example, if you try to save a file using Notepad, which opens and saves .txt files, and then you type my-file as filename, Notepad will automatically change that to my-file.txt. If you wanted to save my-file in the C:\notes\ folder, then the filepath where the application will save the file becomes C:\notes\my-file.txt.

It's possible to explicitly define what should be the extension of the file. If you type my-file.ini in the field, for example, it will save the file as C:\notes\my-file.ini, with the .ini extension instead of the default .txt.

One trick: you can navigate to a folder by its filepath in a file picker by typing the filepath of the folder in the "File name" field and pressing the Enter key. For example, if you typed C:\Users\ and pressed Enter in the filename field, instead of trying to save the file as a folder, the file picker would simply navigate to that folder, displaying its contents.

Keyboard Shortcut

In pretty much all applications, it's possible to save a file through the keyboard shortcut Ctrl+S. This should perform the same action as clicking on File -> Save.

Navigation

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *