Given a list of bash commands to manipulate folders/files. Can you answer the results of a list of existence checking?
Suppose we are under the empty root folder ‘/’. The commands include: mkdir [-p], touch and rm [-r], which are all BSD general commands. If you are not familiar with them, refer to command explanations (备注) after the output example. If the command cannot be executed correctly, just ignore this command.
The questions are existFile or existFolder, which are described as below. A valid path can either be a file or folder, not both.
existFile path
Check whether a file specified by path exists. Output ‘true’ if file exists, ‘false’ otherwise. existFolder path Check whether a folder specified by path exists. Output ‘true’ if folder exists, ‘false’ otherwise.
输入描述:
The first line contains two integers m(1
m
1000) and n((1
n
100) – the number of commands and questions separately.The following m lines are the commands, followed by n lines of questions.
输入样例:
4 2
mkdir -p a/b/c
mkdir a/b/c/d/e
touch file1
rm -r a/b
existFolder /a/b
existFile /file1 输出描述:
For each question, output “true” if the file/folder
exists or “false” otherwise.输出样例
false
true