Questions tagged [filesystems]

A file system is a way of organizing data on a computer system. Typically a file system consists of files, folders (normally a special kind of file) and an API that can be used for interacting with files.

File Systems (or filesystems)

A file system is the specification of how files in a computer should be logically stored, named and organized. File systems present to users a human-readable format of data organization in the computer, where each file is a discrete unit of data.

File systems present only a logical format. They don't necessarily reflect the way the data is physically stored on a computer disk drive, or other storage device. Since the computer actually stores data in bits, data on a storage device lacks any structure; consisting of nothing more than a series of 1s and 0s.

File systems therefore give structure and meaning to that data, by — at the very minimum — giving an arbitrary collection of bits a file name and maintaining a record of this file physical location on the storage device.

Common Elements

Other than file names, common file systems also describe and maintain directories and file attributes, which serve as a means to further structure data organization and to give files specific purposes, security features or functionality.

File systems usually store this information in table-like format in a specific region of the storage device. Each file is listed on this table with its location, length and other properties clearly declared. An operating system that understands the filesystem format can then read this table to access a file in order to edit, rename, delete, move or alter any of its attributes.

For more reading

File System, at Wikipedia

Various file system specifications

9576 questions
3702
votes
21 answers

How to copy files

How do I copy a file in Python?
Matt
  • 84,419
  • 25
  • 57
  • 67
1056
votes
32 answers

Exploring Docker container's file system

I've noticed with docker that I need to understand what's happening inside a container or what files exist in there. One example is downloading images from the docker index - you don't have a clue what the image contains so it's impossible to start…
user2668128
  • 39,482
  • 8
  • 27
  • 34
1004
votes
28 answers

How to use to find files recursively?

I would like to list all files recursively in a directory. I currently have a directory structure like this: src/main.c src/dir/file1.c src/another-dir/file2.c src/another-dir/nested/files/file3.c I've tried to do the following: from glob import…
Ben Gartner
  • 14,413
  • 10
  • 36
  • 34
640
votes
22 answers

How many files can I put in a directory?

Does it matter how many files I keep in a single directory? If so, how many files in a directory is too many, and what are the impacts of having too many files? (This is on a Linux server.) Background: I have a photo album website, and every image…
Kip
  • 107,154
  • 87
  • 232
  • 265
578
votes
16 answers

Quickly create a large file on a Linux system

How can I quickly create a large file on a Linux (Red Hat Linux) system? dd will do the job, but reading from /dev/zero and writing to the drive can take a long time when you need a file several hundreds of GBs in size for testing... If you need to…
DrStalker
  • 9,061
  • 17
  • 43
  • 47
568
votes
9 answers

Node.js check if path is file or directory

I can't seem to get any search results that explain how to do this. All I want to do is be able to know if a given path is a file or a directory (folder).
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
562
votes
8 answers

What's the best way to check if a file exists in C?

Is there a better way than simply trying to open the file? int exists(const char *fname) { FILE *file; if ((file = fopen(fname, "r"))) { fclose(file); return 1; } return 0; }
Dave Marshall
  • 7,367
  • 4
  • 22
  • 15
553
votes
22 answers

How to recursively find and list the latest modified files in a directory with subdirectories and times

Operating system: Linux Filesystem type: ext3 Preferred solution: Bash (script/one-liner), Ruby, or Python I have several directories with several subdirectories and files in them. I need to make a list of all these directories that is…
fredrik
  • 5,655
  • 3
  • 15
  • 7
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
525
votes
35 answers

Remove directory which is not empty

In my Node application I need to remove a directory which has some files, but fs.rmdir only works on empty directories. How can I do this?
sachin
  • 13,605
  • 14
  • 42
  • 55
507
votes
10 answers

Folder management with r : Check existence of directory and create it if it doesn't exist

I often find myself writing R scripts that generate a lot of output. I find it cleaner to put this output into its own directory(s). What I've written below will check for the existence of a directory and move into it, or create the directory and…
Chase
  • 67,710
  • 18
  • 144
  • 161
499
votes
26 answers

How to create a directory using Ansible

How do you create a directory www at /srv on a Debian-based system using an Ansible playbook?
Gaurav Agarwal
  • 18,754
  • 29
  • 105
  • 166
472
votes
4 answers

Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\"), Server.MapPath("/"). What is the difference?

Can anyone explain the difference between Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\") and Server.MapPath("/")?
Manu
  • 28,753
  • 28
  • 75
  • 83
447
votes
21 answers

How to recursively delete an entire directory with PowerShell 2.0?

What is the simplest way to forcefully delete a directory and all its subdirectories in PowerShell? I am using PowerShell V2 in Windows 7. I have learned from several sources that the most obvious command, Remove-Item $targetDir -Recurse -Force,…
Matt Spradley
  • 7,854
  • 9
  • 31
  • 40
436
votes
26 answers

Delete directories recursively in Java

Is there a way to delete entire directories recursively in Java? In the normal case it is possible to delete an empty directory. However when it comes to deleting entire directories with contents, it is not that simple anymore. How do you delete…
paweloque
  • 18,466
  • 26
  • 80
  • 136
1
2 3
99 100