Questions tagged [mkdirs]

87 questions
3
votes
4 answers

Can't create directory with mkdirs() - android

I try to create a directory and use the following code: boolean success = true; String rootDirectory = Environment.getExternalStorageDirectory().toString(); folder = new File(rootDirectory, "Directory"); if(!(folder.exists())) { success =…
ProgFroz
  • 197
  • 4
  • 17
3
votes
2 answers

Why is the mkdirs() method not working?

Before anyone marks this as a duplicate I would like to let you know that I have gone through a lot of the questions about the mkdirs() method on SO and none have worked for me so I believe I have a special case for this problem worthy of a…
John Ernest Guadalupe
  • 6,379
  • 11
  • 38
  • 71
3
votes
2 answers

Mkdirs does not create folder in internal storage (Android)

I'm trying to create a folder in the internal storage of an app so I can download files to it. But it doesn't seem to work. I've been looking for a solution for hours and hours but I can't find one and it's starting to drive me crzay. This the code…
Bouss
  • 205
  • 2
  • 9
  • 20
3
votes
4 answers

Android mkdirs() sdcard do not work

I want to make dir in Sdcard, and i do follow: I added: in manifest. I get root_path by: public static final String ROOT_PATH =…
Justin
  • 4,400
  • 2
  • 32
  • 36
3
votes
2 answers

Android 4.4.2 File.mkdir() and mkdirs() are creating file instead of directory

This question is not related to this question. I have already seen it but it's SPECIFIC Android 4.4.2 issue as the code works fine on other versions of Android. final File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +…
AZ_
  • 21,688
  • 25
  • 143
  • 191
3
votes
5 answers

Undo effects of java mkdirs()

I have a situation where I need to run a "pre-check" to see if a directory is "createable". This is not a problem, just run a file.mkdirs() and see if it returns true. The problem is that I would like to clean up after this check. This is a bit…
user1283068
  • 1,694
  • 4
  • 15
  • 25
3
votes
1 answer

My program doesn't make directories on Windows 8 but it does on Windows 7

My game executes and saves wonderfully on Windows 7, even if the folder I save to doesn't exist. I used the following code (roughly): new File("Data/Saves").mkdirs(); The problem occurred when I sent it to my friend with Windows 8. He said that…
Monkeybro10
  • 267
  • 1
  • 4
  • 8
3
votes
3 answers

Python os.makedirs to recreate path

I want to go through every line in a text file of existing paths and file names, divide the strings into drive, path, and filename. Then what I would like to do is copy the files with their paths to a new location - either a different drive or…
Visceral
  • 253
  • 3
  • 4
  • 8
2
votes
1 answer

How to create non-read-only directories from Java in Windows

I'm creating directories using myFileObject.mkdirs(). In Windows, every directory that gets created is marked as read-only. Although I can (oddly) still write to the directory, it creates aggravation when it comes to deleting things. Is there some…
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
2
votes
0 answers

Jenkins/Groovy: why are functions forbidden by scripts permitted by imported libraries?

Question: why are some functions disallowed if called in a Jenkinsfile, but allowed if called in a shared library that is imported by that same Jenkinsfile? This question is not specific to directory-creation, but I will use it as an example, since…
2
votes
1 answer

Android File.mkdirs changes Context.getFilesDir

This is an android issue. A call to File.mkdirs can change the value of Context.getFilesDir. I've stated the problem this way since I haven't investigated all the test cases. I was very surprised by this result and put together a simple test that…
Tom Rutchik
  • 1,183
  • 1
  • 12
  • 15
2
votes
1 answer

Recursive directory creation fails on device

My code runs in the simulator, but crashes on Android with a FileNotFoundException as it tries to FileSystemStorage#openOutputStream in an non-existing directory. I create all the needed directories recursively before using private void…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
2
votes
2 answers

What is the reason for this method to take so much memory?

im trying to debug this method but it seems that nothing works... I suspect that in the conditional statement pathName.add() is cousing trouble. After this method is executed it takes up 50 MB executed one more time it takes up 150mb till it reaches…
Artiom
  • 81
  • 12
2
votes
3 answers

Java - File - mkdirs doesn't make dirs

new File(filePath, "/classes/").mkdirs(); filePath is a directory and it exists. classes is a new directory, that should be created I believe that mkdirs thinks that classes is a file and doesn't do anything, but when I execute new File(filePath,…
ivan
  • 287
  • 3
  • 14
2
votes
2 answers

Python create directory failing

I am using some pretty standard code: 1 if not os.path.exists(args.outputDirectory): 2 if not os.makedirs(args.outputDirectory, 0o666): 3 sys.exit('Fatal: output directory "' + args.outputDirectory + '" does not exist and cannot…
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551