Filename

Share

What's a File Name?

A filename (or file name) is the name a file has inside its folder, which is the last part of the filepath. For example, in the filepath C:\photos\tree.jpg, the filename would be tree.jpg. May also refer to the name of a folder has inside its parent folder, e.g. photos inside C:\. Sometimes, filename is used to refer to the entire filepath instead of only the last part.

A filename typically contains a file extension. For example, in the filename tree.jpg, the file extension is .jpg.

On Linux, there's a command called basename that displays the filename of a filepath, and can also remove the extension but only if you already know what's the extension of the file, e.g.:1

> basename /u/dee/desktop/cns.boo .boo
cns

References

  1. https://www.ibm.com/docs/en/aix/7.3?topic=b-basename-command (accessed 2024-05-21) ↩︎

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *