Questions tagged [filenames]

Filenames are metadata about a file; a string used to uniquely identify a file stored on the file system of a computer.

The filename is metadata about a file; a special kind of string used to uniquely identify a file stored on the file system of a computer. Some operating systems also identify directories in the same way. Different operating systems impose different restrictions on length and allowed characters on filenames.

4148 questions
62
votes
6 answers

How to open a "-" dashed filename using terminal?

I tried gedit, nano, vi, leafpad and other text editors , it won't open, I tried cat and other file looking commands, and I ensure you it's a file not a directory!
Alfran
  • 1,301
  • 1
  • 10
  • 19
62
votes
10 answers

.htm or .html extension - which one is correct and what is different?

When I save a file with an .htm or .html extension, which one is correct and what is different?
user21067
  • 663
  • 2
  • 6
  • 8
61
votes
7 answers

Find commits that modify file names matching a pattern in a GIT repository

I'd like to find commits in my code base that add video files to throw them out. Is there a way to look for these files in git ? For example let's say all videos have a filename ending with the extension .wmv ; I'd like to find all commits…
Bastes
  • 1,116
  • 1
  • 9
  • 18
59
votes
8 answers

Git pull error: unable to create file (Invalid argument)

I am trying to sync remote repo with local repo but getting following errors. Some files (which have not extention) are not getting sync with local repo on WINDOWS machine, but I could sync successfully on MAC machine. Is there any configuration…
Amol Dadas
  • 799
  • 2
  • 8
  • 17
59
votes
7 answers

How to get a file in Windows with a colon in the filename?

I am getting errors from customers who are uploading files with a colon in the file name, i.e. C:/uploads/test : doc.html I assume that some Unix or Linux system is generating the file but I'm not sure how the users are saving them with the invalid…
David
  • 709
  • 1
  • 5
  • 6
58
votes
4 answers

How do you import a file in python with spaces in the name?

Do I have to take out all the spaces in the file name to import it, or is there some way of telling import that there are spaces?
lilfrost
  • 590
  • 1
  • 4
  • 7
57
votes
22 answers

How would you make a unique filename by adding a number?

I would like to create a method which takes either a filename as a string or a FileInfo and adds an incremented number to the filename if the file exists. But can't quite wrap my head around how to do this in a good way. For example, if I have this…
Svish
  • 152,914
  • 173
  • 462
  • 620
56
votes
8 answers

What characters allowed in file names on Android?

What special characters are allowed for file names on Android? ~!@#$%^&*()_+/\., Also, can I save file with Unicode name?
alex2k8
  • 42,496
  • 57
  • 170
  • 221
55
votes
2 answers

Obtaining only the filename when using OpenFileDialog property "FileName"

I am trying to include only the filename of the file I've selected in the OpenFileDialog in the label1.Text property, but I haven't found a solution yet. I know I could use a method from the string class on the ofd instance to filter out the whole…
Birdman
  • 5,244
  • 11
  • 44
  • 65
55
votes
11 answers

Validate a file name on Windows

public static boolean isValidName(String text) { Pattern pattern = Pattern.compile("^[^/./\\:*?\"<>|]+$"); Matcher matcher = pattern.matcher(text); boolean isMatch = matcher.matches(); return isMatch; } Does this method guarantee a…
Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417
53
votes
4 answers

How to set filename containing spaces in Content-Disposition header

I have this piece of code: resp.addHeader("Content-Disposition", "inline; filename=" + fileName); When the file name is "a_b_c.doc" or "abc.doc" the name of the downloaded file is displayed correctly. However, when the file name is "a b c .doc" the…
Huy Than
  • 1,538
  • 2
  • 16
  • 31
51
votes
4 answers

Convert a filename to a file:// URL

In WeasyPrint’s public API I accept filenames (among other types) for the HTML inputs. Any filename that works with the built-in open() should work, but I need to convert it to an URL in the file:// scheme that will later be passed to…
Simon Sapin
  • 9,790
  • 3
  • 35
  • 44
47
votes
2 answers

What is the convention for Lisp filename extension?

".el" is the convention for filename ending with Emacs Lisp programs. What is the convention when writing Common Lisp programs, please?
yves Baumes
  • 8,836
  • 7
  • 45
  • 74
45
votes
9 answers

Regular expression to remove a file's extension

I am in need of a regular expression that can remove the extension of a filename, returning only the name of the file. Here are some examples of inputs and outputs: myfile.png -> myfile myfile.png.jpg -> myfile.png I can obviously do this…
Andreas Grech
  • 105,982
  • 98
  • 297
  • 360
43
votes
5 answers

Convert DateTime.Now to a valid Windows filename

I have had this issue quite a few times and have just been using a workaround but thought I would ask here in case there is an easier option. When I have a string from DateTime.Now and I then want to use this in a filename I can't because Windows…
Bali C
  • 30,582
  • 35
  • 123
  • 152