1
I am trying to create a folder with the same name as the current date but simply does not create.
import java.util.*;
import java.io.File;
public class PastaData {
Date data = new Date();
SimpleDateFormat formatar = new SimpleDateFormat("d/m/y");
String dataFormatada = new formatar.format(data);
System.out.println("dataFormatada");
File file = new File(dataFormatada);
file.mkdir();
}
Which path is the creation of the folder? The way it is in the code, is creating inside your project. Try this way:
File file = new File("C:\" + dataFormatada);
and go to this address and see if created.– user28595
@diegofm probably directly in C: it will not have access permission. I think it is best to create in the project folder, but not within the project.
– Sorack
@Sorack as you know he has no access?
– user28595
Hehehehehe usually on my PC gives this, and my user is administrator
– Sorack
I tried to use the command you told me but still nothing changed :(
– Felipe Moreno Borges
@Sorack depends on how your system is configured with security directives, or if your user is not an administrator, here it works normally without having to elevate prompt privileges, but my user is a system administrator.
– user28595
Was any of the answer helpful? Don’t forget to choose one and mark it so it can be used if someone has a similar question!
– Sorack