// Path: app/src/main/java/com/paulds/simpleftp/data/entities/FileEntity.java
// public class FileEntity implements Comparable<FileEntity> {
// 
//     /**
//      * The file name.
//      */
//     private String name;
// 
//     /**
//      * The file path.
//      */
//     private String path;
// 
//     /**
//      * The file size.
//      */
//     private Long size;
// 
//     /**
//      * Indicates whether this file is a directory.
//      */
//     private boolean isDirectory;
// 
//     /**
//      * Gets the file name.
//      * @return The file name.
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * Sets the file name.
//      * @param name The file name.
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Gets the file path.
//      * @return The file path.
//      */
//     public String getPath() {
//         return path;
//     }
// 
//     /**
//      * Sets the file path.
//      * @param path The file path.
//      */
//     public void setPath(String path) {
//         this.path = path;
//     }
// 
//     /**
//      * Gets the file size.
//      * @return The file size.
//      */
//     public Long getSize() {
//         return size;
//     }
// 
//     /**
//      * Sets the file size.
//      * @param size The file size.
//      */
//     public void setSize(long size) {
//         this.size = size;
//     }
// 
//     /**
//      * Indicates whether this file is a directory.
//      * @return true if the file is a directory; false otherwise
//      */
//     public boolean isDirectory() {
//         return isDirectory;
//     }
// 
//     /**
//      * Set a value indicating whether this file is a directory.
//      * @param isDirectory true if the file is a directory; false otherwise
//      */
//     public void setIsDirectory(boolean isDirectory) {
//         this.isDirectory = isDirectory;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int compareTo(FileEntity file) {
//         if(this.isDirectory() && !file.isDirectory()) {
//             return -1;
//         }
//         else if(!this.isDirectory() && file.isDirectory()) {
//             return 1;
//         }
//         else {
//             return this.getName().compareToIgnoreCase(file.getName());
//         }
//     }
// }


import android.os.Environment;
import com.paulds.simpleftp.data.entities.FileEntity;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
     */
    public void createFolder(String path, String name) {
        String fullPath = Environment.getExternalStorageDirectory().toString() + path + "/" + name;

        File folder = new File(fullPath);

        if(!folder.exists()) {
            folder.mkdir();
        }
    }

    /**
     * Delete a list of files and directories.
     * @param elements The specified list.
     */
    public void deleteFiles(List<FileEntity> elements) {
        for (FileEntity element: elements) {
            File file = new File(element.getPath());

            if(file.exists()) {
                file.delete();
            }
        }
    }

    /**
     * Indicates whether the storage is writable.
     * @return A value indicating whether the storage is writable.
     */
    private boolean isExternalStorageWritable() {
// Path: app/src/main/java/com/paulds/simpleftp/data/entities/FileEntity.java
// public class FileEntity implements Comparable<FileEntity> {
// 
//     /**
//      * The file name.
//      */
//     private String name;
// 
//     /**
//      * The file path.
//      */
//     private String path;
// 
//     /**
//      * The file size.
//      */
//     private Long size;
// 
//     /**
//      * Indicates whether this file is a directory.
//      */
//     private boolean isDirectory;
// 
//     /**
//      * Gets the file name.
//      * @return The file name.
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * Sets the file name.
//      * @param name The file name.
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Gets the file path.
//      * @return The file path.
//      */
//     public String getPath() {
//         return path;
//     }
// 
//     /**
//      * Sets the file path.
//      * @param path The file path.
//      */
//     public void setPath(String path) {
//         this.path = path;
//     }
// 
//     /**
//      * Gets the file size.
//      * @return The file size.
//      */
//     public Long getSize() {
//         return size;
//     }
// 
//     /**
//      * Sets the file size.
//      * @param size The file size.
//      */
//     public void setSize(long size) {
//         this.size = size;
//     }
// 
//     /**
//      * Indicates whether this file is a directory.
//      * @return true if the file is a directory; false otherwise
//      */
//     public boolean isDirectory() {
//         return isDirectory;
//     }
// 
//     /**
//      * Set a value indicating whether this file is a directory.
//      * @param isDirectory true if the file is a directory; false otherwise
//      */
//     public void setIsDirectory(boolean isDirectory) {
//         this.isDirectory = isDirectory;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int compareTo(FileEntity file) {
//         if(this.isDirectory() && !file.isDirectory()) {
//             return -1;
//         }
//         else if(!this.isDirectory() && file.isDirectory()) {
//             return 1;
//         }
//         else {
//             return this.getName().compareToIgnoreCase(file.getName());
//         }
//     }
// }


// Path: app/src/main/java/com/paulds/simpleftp/data/repository/FileRepository.java
import android.os.Environment;
import com.paulds.simpleftp.data.entities.FileEntity;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

     */
    public void createFolder(String path, String name) {
        String fullPath = Environment.getExternalStorageDirectory().toString() + path + "/" + name;

        File folder = new File(fullPath);

        if(!folder.exists()) {
            folder.mkdir();
        }
    }

    /**
     * Delete a list of files and directories.
     * @param elements The specified list.
     */
    public void deleteFiles(List<FileEntity> elements) {
        for (FileEntity element: elements) {
            File file = new File(element.getPath());

            if(file.exists()) {
                file.delete();
            }
        }
    }

    /**
     * Indicates whether the storage is writable.
     * @return A value indicating whether the storage is writable.
     */
    private boolean isExternalStorageWritable() {
        String state = Environment.getExternalStorageState();