package sk.upjs.paz1a.cvicenie7;
import java.io.File;
import java.util.Arrays;
import sk.upjs.jpaz2.Turtle;
public class TurtleCommander extends Turtle {
public void listDirectory(File adresar) {
String[] subory = adresar.list();
// vypis suborov
// System.out.println(Arrays.toString(subory));
for (int i = 0; i < subory.length; i++) {
System.out.println(subory[i]);
}
}
public int countFiles(File adresar) {
int pocitadlo = 0;
File[] subory = adresar.listFiles();
// pocitanie suborov, bez adresarov
for (int i = 0; i < subory.length; i++) {
if (subory[i].isFile()) {
pocitadlo++;
}
}
return pocitadlo;
}
public long totalSizeOfFilesInDirectory(File adresar) {
long sucetVelkosti = 0;
File[] subory = adresar.listFiles();
// pocitanie suborov, bez adresarov
for (int i = 0; i < subory.length; i++) {
if (subory[i].isFile()) {
sucetVelkosti += subory[i].length();
}
}
return sucetVelkosti;
}
public boolean containEqualFilenames(File adresar1, File adresar2) {
return false;
}
}