Filer

Filer

Förkortningar

  • EOF - end-of-file

Font Awesome

  • fa-file
  • fa-file-o

Rättigheter

#Permissionrwx
7read, write and executerwx
6read and writerw-
5read and executer-x
4read onlyr--
3write and execute-wx
2write only-w-
1execute only--x
0none---

Rättigheter

  1. No permissions ("---")
  2. Execute only (rare) ("--x")
  3. Write only (rare) ("-w-")
  4. Write and execute (rare) ("-wx")
  5. Read only ("r--")
  6. Read and execute ("r-x")
  7. Read and write ("rw-")
  8. Read, write, and execute ("rwx")

Version av file

file --version

Vilken file?

which file

Sökväg

/usr/bin/file

How can I get a count of files in a directory using the command line?

ls folder | wc -l

Komprimera

gzip -cr folder file.gz

Read a file with PHP

$my_file = 'file.txt'; $handle = fopen($my_file, 'r'); $data = fread($handle,filesize($my_file));

Write to a file with PHP

$my_file = 'file.txt'; $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); $data = 'This is the data'; fwrite($handle, $data);

Append to a file with PHP

$my_file = 'file.txt'; $handle = fopen($my_file, 'a') or die('Cannot open file: '.$my_file); $data = 'New data line 1'; fwrite($handle, $data); $new_data = " ".'New data line 2'; fwrite($handle, $new_data);

Close a file with PHP

$my_file = 'file.txt'; $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); //write some data here fclose($handle);

Delete a file with PHP

$my_file = 'file.txt'; unlink($my_file);

filemtime

Externa länkar

Fila logotyp

Kuriosa