Академический Документы
Профессиональный Документы
Культура Документы
1 (files)
2. File Info
Given the path of a file, print this info about it:
- if file exists
- its absolute path, type (dir or file), size and last update date
- if it's writable
Test it then with some absolute and some relative paths (even something like “.”)
3. Folder contents
Given the path of a directory:
- list its direct descendants (files+dirs):
- should display one line for each, with the name and size
- list should be sorted descending by size
- OPTIONAL: place the directories first and sorted ascending by name (and after
them the files descending by size)
- display the total size of all files
4. Find file (by name)
- Read from user:
- the path of a base directory
- a file name pattern to search for (a String value)
- Search under that base dir (and all its subfolders!) for a file/dir which contains in its name
the given pattern (case insensitive)
- You should stop and return only the first file found (we don't care if there are multiple
matching files), and display its full path, or display another message if no file was found
Example:
- Given base path: ".\doc":
- for pattern: "week8_TE" it should find and display the path of this file (if started
from this project, like: "C:\....\doc\s4_week8_tema.txt")
- for pattern: "week9_" it should display a message like: "No files found matching
pattern: 'week9_'"
BONUS:
- if a file was found, show more info about it: name, size, if it's a dir or not (how can you do
that in a more optimal way, what could you change in the signature of your recursive
function?)
- show all the matching files, not just the first one (show full info for each, not just name)
d. Write these statistics to a new text file (named like initial file + '_statistics.txt' suffix)
File format:
- it doesn't have a separate/special header row
- all rows represent persons, having the same format: [name],[cnp],[age],[height],[sex]
- expected field types:
- name - a String
- cnp - a long number
- age, height - a positive integer value
- sex - one of these 2 values: 'F'/'M'