Are both names synonyms or should one prefer one name over the other on different platforms?
As seen in this question, they are not the same.
Windows 95 introduced Windows Explorer and along with it the term folder. What is the relationship between folders and directories?
Some people believe that Windows 95 renamed directories to folders, but it's actually more than that.
Windows Explorer lets you view folders, which are containers in the shell namespace. Directories are one type of folder, namely, folders which correspond to file system locations. There are other types of folders, such as Control Panel or Network Neighborhood or Printers. These other types of folders represent objects in the shell namespace which do not correspond to files. In common usage, the term virtual folder has been applied to refer to folders which are not directories. In other words, we have this Euler diagram:
(Virtual folders = Folders − Directories)
In general, code which manipulates the shell namespace should operate on folders and items, not directories and files, so as not to tie themselves to a particular storage medium. For example, code which limits itself to files won't be able to navigate into a Zip file, since the contents of a Zip file are exposed in the form of a virtual folder.
As a reference to physical locations on the hard drive they are synonyms.
Windows tends to use "Folder".
*nix tends to use "Directory".
On Windows you have virtual folders (as mentioned in malfruct's answer) which are represented as directories but can be actually stored as files (zip files for example).
However, to the end user this distinction doesn't usually matter.
@mafu quotes Raymond Chen as writing:
Windows 95 introduced Windows Explorer and along with it the term folder.
Raymond Chan is rewriting history.
In fact, Microsoft Windows 95 borrowed many UI design ideas from Apple. And Apple in turn borrowed them from Xerox. Both the name "folder" and the visual metaphor of folders were part of the Xerox Star office environment in 19821.
1 - In 1985, I used a DLion workstation running Xerox software to write my PhD thesis ... if you want a source for that fact.
For GUI platforms, "Folder" name is recommended where as for command line environment, "Directory" name is suited.
Actually, in this MSDN page, you can read :
In Windows, the terms "directory" and "folder" are used interchangeably. Most documentation and user interface text uses the term "folder," but the .NET Framework class library uses the term "directory."
So I think that both are fine. I tend to use "folder" as it's shorter and I'm lazy.
What humanfly said, with the additional note that some programs use "Folder" but NEVER directory, i.e. in email programs like Outlook. You never have "subdirectories" but you often have "subfolders".