My FileSystem CLI Program
CLI program with functionality of working with files in a file system. The methods that can be executed by the program:
-
ls - displays a list of all files and directories for
path
:public static void listDirectory(String path) {...};
-
ls_py - displays a list of files with the
.py
extension in `pathpublic static void listPythonFiles(String path) {...};
-
id_dir - outputs
true
ifpath
is a directory, otherwisefalse
public static void isDirectory(String path) {...};
-
define - outputs
directory
orfile
depending on the type ofpath
public static void define(String path) {...};
-
readmod - displays rights for the file in
rwx
format for the current userpublic static void printPermissions(String path) {...};
-
setmod - sets rights for the file
path
public static void setPermissions(String path, String permissions) {...};
-
cat - displays file content
public static void printContent(String path) {...};
-
append - adds the line
# Autogenerated line
at the end ofpath
public static void appendFooter(String path) {...};
-
bc - creates a copy of
path
in the directory/tmp/${date}.backup
, where date is the date in the formatdd-mm-yyyy
.path
can be a directory or a file. When a directory, the entire content is copied.public static void createBackup(String path) {...};
-
greplong - displays the longest word in the file
public static void printLongestWord(String path) {...};
-
help - displays a list of commands and their descriptions
public static void help() {...};
-
exit - terminates the program
public static void exit() {...};
After launching, the program should display a list of available commands and their descriptions; then wait for a command from the user. The available commands can also be accessed through the help() method.