Questions tagged [file]

A block of arbitrary information, or resource for storing information, accessible by the string-based name or path. Files are available to computer programs and are usually based on some kind of persistent storage.

A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper documents which traditionally are kept in offices' and libraries' files, and this is the source of the term.

In modern computer architectures, files are organized in a tree structure. On the top, you have a root like C:\ in systems. There are several subfolders (inner nodes) below the root, e.g. Program Files or Users. The computer files, which contain the data, are the leaves of that tree.

On based systems, many types of system information are also represented as files, in filesystems such as sysfs and devfs, even though they don't represent information on a durable storage medium.


References


Related

, , , , ,

81192 questions
568
votes
33 answers

How do I get the file extension of a file in Java?

Just to be clear, I'm not looking for the MIME type. Let's say I have the following input: /path/to/file/foo.txt I'd like a way to break this input up, specifically into .txt for the extension. Is there any built in way to do this in Java? I would…
longda
  • 10,153
  • 7
  • 46
  • 66
552
votes
22 answers

linux command to get size of files and directories present in a particular folder?

How can I see the size of files and directories in Linux? If use df -m, then it shows the size of all the directory at the top level, but, for the directories and files inside the directory, how do I check the size?
Advait
  • 5,771
  • 3
  • 18
  • 18
550
votes
11 answers

Using cURL to upload POST data with files

I would like to use cURL to not only send data parameters in HTTP POST but to also upload files with specific form name. How should I go about doing that ? HTTP Post parameters: userid = 12345 filecomment = This is an image file HTTP File…
thotheolh
  • 7,040
  • 7
  • 33
  • 49
547
votes
26 answers

How do I get the path and name of the python file that is currently executing?

I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using execfile: script_1.py calls script_2.py. In turn, script_2.py…
Ray
  • 187,153
  • 97
  • 222
  • 204
544
votes
14 answers

How can I get Eclipse to show .* files?

By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.
jodonnell
  • 49,859
  • 10
  • 62
  • 67
544
votes
17 answers

Compare two files in Visual Studio

I saw the new comparison tool in Visual Studio 2012 for comparing two files or two versions of a file. I like it. But when I tried to find it I couldn't it, because I don't use TFS. Is there a way how I can just compare two files with the built-in…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
540
votes
13 answers

Reading a file line by line in Go

I'm unable to find file.ReadLine function in Go. How does one read a file line by line?
g06lin
  • 5,725
  • 3
  • 18
  • 13
535
votes
4 answers

Is the MIME type 'image/jpg' the same as 'image/jpeg'?

Pretty simple question but can't seem to find it anywhere online. I'm trying to make a program that depending on the file type will give me the extension.
Joe Scotto
  • 10,936
  • 14
  • 66
  • 136
532
votes
17 answers

How to create a file in Linux from terminal window?

What's the easiest way to create a file in Linux terminal?
raffian
  • 31,267
  • 26
  • 103
  • 174
505
votes
7 answers

Find a file by name in Visual Studio Code

How can I find a file by name in Visual Studio Code? A Visual Studio shortcut I'm used to is CTRL+,, but it does not work here.
Nenad
  • 24,809
  • 11
  • 75
  • 93
504
votes
29 answers

Convert file: Uri to File in Android

What is the easiest way to convert from an android.net.Uri object which holds a file: type to a java.io.File object in Android? I tried the following but it doesn't work: File file = new File(Environment.getExternalStorageDirectory(),…
hpique
  • 119,096
  • 131
  • 338
  • 476
502
votes
9 answers

VS 2012: Scroll Solution Explorer to current file

VS2010 had the feature that viewing a file would automatically cause Solution Explorer to scroll to that file. With VS2012, viewing different files from within the IDE no longer scrolls and select the file in Solution Explorer automatically. Is it…
Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130
495
votes
8 answers

How to append one file to another in Linux from the shell?

I have two files: file1 and file2. How do I append the contents of file2 to file1 so that contents of file1 persist the process?
asir
  • 12,843
  • 8
  • 24
  • 18
486
votes
23 answers

Better way to check if a Path is a File or a Directory?

I am processing a TreeView of directories and files. A user can select either a file or a directory and then do something with it. This requires me to have a method which performs different actions based on the user's selection. At the moment I am…
SnAzBaZ
  • 6,389
  • 4
  • 23
  • 22
472
votes
19 answers

How can I download a file from a URL in C#?

What is a simple way of downloading a file from a URL path?
vbroto
  • 6,088
  • 3
  • 22
  • 12