this.file.listDir won't return folders under the applicationStorageDirectoryList the files that are stored in the download folder on an Android devicecould not bring image to view were image captured by cordovapluginno provider for BarcodeScannerIonic 2 File Plugin - Creating Directory ErrorIonic File Transfer Plugin not working in production versionIs it possible copy file in the private path to document directory?IONIC 3 and jsPDF , using FILE Transfer to download pdf not workingRead File as Array From SD Card in cordova (ionic) with cordova-plugin-fileionic 3 capacitor return file paths from document directoryIonic 3 display data directory image
If hash functions append the length, why does length extension attack work?
Count the identical pairs in two lists
Why is there an extra "t" in Lemmatization?
Why do we need an estimator to be consistent?
How can I deal with someone that wants to kill something that isn't supposed to be killed?
Can the caster of Time Stop still use their bonus action or reaction?
Piece of fabric in planter, how to use it?
Why was Quirrell said to be in the Black Forest if Voldemort was actually in Albania?
Trivial non-dark twist in dark fantasy
How did pilots avoid thunderstorms and related weather before “reliable” airborne weather radar was introduced on airliners?
Reissue US, UK, Canada visas in stolen passports
Strange LED behavior
Killing a star safely
How to deal with making design decisions
How to pass array of values in lualatex?
What would be the effects of (relatively) widespread precognition on the stock market?
Adding gears to my grandson's 12" bike
Did Don Young threaten John Boehner with a 10 inch blade to the throat?
Is it OK to accept a job opportunity while planning on not taking it?
What are "the high ends of castles" called?
How should I handle a question regarding my regrets during an interview?
Please let me know why 2/16 has a remainder of 2. Thanks
What is the metal bit in the front of this propeller spinner?
Acoustic guitar chords' positions vs those of a Bass guitar
this.file.listDir won't return folders under the applicationStorageDirectory
List the files that are stored in the download folder on an Android devicecould not bring image to view were image captured by cordovapluginno provider for BarcodeScannerIonic 2 File Plugin - Creating Directory ErrorIonic File Transfer Plugin not working in production versionIs it possible copy file in the private path to document directory?IONIC 3 and jsPDF , using FILE Transfer to download pdf not workingRead File as Array From SD Card in cordova (ionic) with cordova-plugin-fileionic 3 capacitor return file paths from document directoryIonic 3 display data directory image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
when I am trying to list my folder directory with ionic-native file i am not getting any folders in result.
My Code:
this.platform.ready().then(() =>
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '').then((result) =>
console.log(result);
/*result will have an array of file objects with
file details or if its a directory*/
for (let file of result)
if (file.isDirectory == true && file.name != '.' && file.name != '..')
console.log("This is a folder");
// Code if its a folder
else if (file.isFile == true)
// Code if its a file
console.log("This is a file");
let name = file.name // File name
console.log("file name: " + name);
// let path = file.path // File path
file.getMetadata(function (metadata)
let size = metadata.size; // Get file size
)
);
);
I am using: "@ionic-native/file": "4.12.0",
With imports:
import File from '@ionic-native/file';
cordova ionic3 cordova-plugins ionic-native cordova-plugin-file
add a comment |
when I am trying to list my folder directory with ionic-native file i am not getting any folders in result.
My Code:
this.platform.ready().then(() =>
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '').then((result) =>
console.log(result);
/*result will have an array of file objects with
file details or if its a directory*/
for (let file of result)
if (file.isDirectory == true && file.name != '.' && file.name != '..')
console.log("This is a folder");
// Code if its a folder
else if (file.isFile == true)
// Code if its a file
console.log("This is a file");
let name = file.name // File name
console.log("file name: " + name);
// let path = file.path // File path
file.getMetadata(function (metadata)
let size = metadata.size; // Get file size
)
);
);
I am using: "@ionic-native/file": "4.12.0",
With imports:
import File from '@ionic-native/file';
cordova ionic3 cordova-plugins ionic-native cordova-plugin-file
add a comment |
when I am trying to list my folder directory with ionic-native file i am not getting any folders in result.
My Code:
this.platform.ready().then(() =>
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '').then((result) =>
console.log(result);
/*result will have an array of file objects with
file details or if its a directory*/
for (let file of result)
if (file.isDirectory == true && file.name != '.' && file.name != '..')
console.log("This is a folder");
// Code if its a folder
else if (file.isFile == true)
// Code if its a file
console.log("This is a file");
let name = file.name // File name
console.log("file name: " + name);
// let path = file.path // File path
file.getMetadata(function (metadata)
let size = metadata.size; // Get file size
)
);
);
I am using: "@ionic-native/file": "4.12.0",
With imports:
import File from '@ionic-native/file';
cordova ionic3 cordova-plugins ionic-native cordova-plugin-file
when I am trying to list my folder directory with ionic-native file i am not getting any folders in result.
My Code:
this.platform.ready().then(() =>
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '').then((result) =>
console.log(result);
/*result will have an array of file objects with
file details or if its a directory*/
for (let file of result)
if (file.isDirectory == true && file.name != '.' && file.name != '..')
console.log("This is a folder");
// Code if its a folder
else if (file.isFile == true)
// Code if its a file
console.log("This is a file");
let name = file.name // File name
console.log("file name: " + name);
// let path = file.path // File path
file.getMetadata(function (metadata)
let size = metadata.size; // Get file size
)
);
);
I am using: "@ionic-native/file": "4.12.0",
With imports:
import File from '@ionic-native/file';
cordova ionic3 cordova-plugins ionic-native cordova-plugin-file
cordova ionic3 cordova-plugins ionic-native cordova-plugin-file
asked Mar 26 at 13:29
Rajdeep ChandraRajdeep Chandra
135 bronze badges
135 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You have not passed the directory name in this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '')
you have to pass directory name in this method. You can get directory name from the this.filesystem.applicationStorageDirectory
. First alert this.filesystem.applicationStorageDirectory
and check which type of path you get.
If path is like :
file:///storage/emulator/0/somefolder
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder";
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
If there is slash(/) in the last of path like :
file:///storage/emulator/0/somefolder/
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder/";
appStorageDir = appStorageDir.substring(0,appStorageDir.lastIndexOf("/"));
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
Now pass that dirName in method as following :
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, dirName)
Hope it will help you !!!
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55358395%2fthis-file-listdir-wont-return-folders-under-the-applicationstoragedirectory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have not passed the directory name in this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '')
you have to pass directory name in this method. You can get directory name from the this.filesystem.applicationStorageDirectory
. First alert this.filesystem.applicationStorageDirectory
and check which type of path you get.
If path is like :
file:///storage/emulator/0/somefolder
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder";
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
If there is slash(/) in the last of path like :
file:///storage/emulator/0/somefolder/
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder/";
appStorageDir = appStorageDir.substring(0,appStorageDir.lastIndexOf("/"));
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
Now pass that dirName in method as following :
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, dirName)
Hope it will help you !!!
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
add a comment |
You have not passed the directory name in this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '')
you have to pass directory name in this method. You can get directory name from the this.filesystem.applicationStorageDirectory
. First alert this.filesystem.applicationStorageDirectory
and check which type of path you get.
If path is like :
file:///storage/emulator/0/somefolder
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder";
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
If there is slash(/) in the last of path like :
file:///storage/emulator/0/somefolder/
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder/";
appStorageDir = appStorageDir.substring(0,appStorageDir.lastIndexOf("/"));
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
Now pass that dirName in method as following :
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, dirName)
Hope it will help you !!!
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
add a comment |
You have not passed the directory name in this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '')
you have to pass directory name in this method. You can get directory name from the this.filesystem.applicationStorageDirectory
. First alert this.filesystem.applicationStorageDirectory
and check which type of path you get.
If path is like :
file:///storage/emulator/0/somefolder
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder";
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
If there is slash(/) in the last of path like :
file:///storage/emulator/0/somefolder/
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder/";
appStorageDir = appStorageDir.substring(0,appStorageDir.lastIndexOf("/"));
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
Now pass that dirName in method as following :
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, dirName)
Hope it will help you !!!
You have not passed the directory name in this.filesystem.listDir(this.filesystem.applicationStorageDirectory, '')
you have to pass directory name in this method. You can get directory name from the this.filesystem.applicationStorageDirectory
. First alert this.filesystem.applicationStorageDirectory
and check which type of path you get.
If path is like :
file:///storage/emulator/0/somefolder
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder";
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
If there is slash(/) in the last of path like :
file:///storage/emulator/0/somefolder/
then get the directory name as following :
let appStorageDir = "file:///storage/emulator/0/somefolder/";
appStorageDir = appStorageDir.substring(0,appStorageDir.lastIndexOf("/"));
let dirName = appStorageDir.substring(appStorageDir.lastIndexOf("/")+1);
Now pass that dirName in method as following :
this.filesystem.listDir(this.filesystem.applicationStorageDirectory, dirName)
Hope it will help you !!!
edited Mar 26 at 14:18
answered Mar 26 at 14:04
Kishan BhardaKishan Bharda
2501 gold badge2 silver badges14 bronze badges
2501 gold badge2 silver badges14 bronze badges
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
add a comment |
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
Thanks this works.
– Rajdeep Chandra
Mar 27 at 6:23
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55358395%2fthis-file-listdir-wont-return-folders-under-the-applicationstoragedirectory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown