Create directory failed in file system

Put your problem here if it does not fit any of the other categories.

Create directory failed in file system

Postby cabernet1976 » Thu Jan 17, 2008 5:29 pm

Create directory successfully in SD card:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.            File sddir = new File("/sdcard/mydir1");
  2.  
  3.                 if (!sddir.mkdirs()) {
  4.  
  5.                         Log.e(TAG, "Create dir in sdcard failed");
  6.  
  7.                         return;
  8.  
  9.                 }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But create dir failed in file system:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 try {
  2.  
  3.                         File dir = getFileStreamPath("mydir2");
  4.  
  5.                         if (!dir.mkdirs()) {
  6.  
  7.                                 Log.e(TAG, "Create dir in local failed"); //<--print this error
  8.  
  9.                                 return;
  10.  
  11.                         }
  12.  
  13.                 } catch (FileNotFoundException e1) {
  14.  
  15.                         Log.e(TAG, "error 1: "+e1.toString());
  16.  
  17.                 }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Could you tell me what I have missed? :roll:
Upload2Flickr's blog: http://upload2flickr.blogspot.com
cabernet1976
Senior Developer
Senior Developer
 
Posts: 154
Joined: Fri Nov 16, 2007 2:34 am
Location: China

Top

Postby plusminus » Mon Jan 21, 2008 9:00 am

Hello cabernet1976,

In the future SDKs there will be a new set of APIs explicitly for creating directories.
This is said to work (but I cannot check it where I am currently):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. getFileStreamPath( "my/directory/name" ).mkdirs()
Parsed in 0.035 seconds, using GeSHi 1.0.8.4

Perhaps yours is not working, because it already exists (already created a run before :?: ) :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby cabernet1976 » Tue Jan 22, 2008 2:18 am

Thanks plusminus.
Upload2Flickr's blog: http://upload2flickr.blogspot.com
cabernet1976
Senior Developer
Senior Developer
 
Posts: 154
Joined: Fri Nov 16, 2007 2:34 am
Location: China

Postby thao » Tue Oct 28, 2008 4:30 pm

Hello,

I've got the opposite issue as cabernet1976. I succeed to create some folder in the /data/data/myApp folder but nothing on the SDcard with the same code.

Is there any permission to grant or something like that ?
Please Advise.
Thank
thao
Freshman
Freshman
 
Posts: 4
Joined: Tue Oct 28, 2008 3:35 pm

Re: Create directory failed in file system

Postby farhan » Tue Nov 23, 2010 7:05 am

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  2.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

try this permission used to write external storage
farhan
Freshman
Freshman
 
Posts: 2
Joined: Sun Oct 24, 2010 5:59 pm

Re: Create directory failed in file system

Postby hollister » Thu Mar 01, 2012 1:52 pm

Today, an individual needs to receive interested to know, where and just how? The answer then is not too complicated. You will be simply made to continue being contemporary concerning the supplies from the firm
mulberry handbags where to buy
mulberry handbags york
mulberry handbags 2011
mulberry handbags 2006
hollister
Freshman
Freshman
 
Posts: 5
Joined: Wed Feb 08, 2012 8:42 am

Top

Re: Create directory failed in file system

Postby nuetronprotron » Mon Mar 05, 2012 1:57 pm

Hi Thao,
what u are telling is something not possible,check your code u may not have provided the path in creating the file and other thing rather than giving hardcoding like "sdcard/filename" try to use getExternalStroge() method which will give u dynamically the path of sd card mounted.
nuetronprotron
Developer
Developer
 
Posts: 37
Joined: Tue Jan 10, 2012 10:22 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 23 guests