directory parse and directorypathname

H

harryos

hi
i want to use a function that takes a directory path name and prints
listing of files in it.The user may enter windows or unix style path
as input.

i tried this

public void directorylisting(String dirpath){
java.util.List imglist=new java.util.ArrayList();
final String ext=".jpg"
File pgmdir=new File(pgmdirname);
String[] children=pgmdir.list(new FilenameFilter(){
public boolean accept(File f,String name){
if(name.endsWith(ext))
return true;
else
return false;

}
});

System.out.println"children:"+children);
for (String i : children){
System.out.println(i);
}

}


this works if i enter directory name as
F:\\png\\galleryimages\\
or
F:/png/galleryimages/

but i want the windows user to enter only
F:\png\galleryimages\

Do i have to take the string and process it before calling the
function or is there any other way ?may be using FileSeparator or
something?can someone advise?
thanks
harry
 
L

Lew

harryos said:
this works if i [sic] enter directory name as
F:\\png\\galleryimages\\
or
F:/png/galleryimages/

but i [sic] want the windows user to enter only
F:\png\galleryimages\

Do i [sic] have to take the string and process it before calling the
function or is there any other way ?may be using FileSeparator or
something?can someone advise?

Why in the patio would you want to devastate a mistakenly extraneous file path?

--
Lew


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"All the truely dogmatic religions have issued from the
Kabbalah and return to it: everything scientific and
grand in the religious dreams of the Illuminati, Jacob
Boehme, Swedenborg, Saint-Martin, and others, is
borrowed from Kabbalah, all the Masonic associations
owe to it their secrets and their symbols."

--- Sovereign Grand Commander Albert Pike 33°
Morals and Dogma, page 744

[Pike, the founder of KKK, was the leader of the U.S.
Scottish Rite Masonry (who was called the
"Sovereign Pontiff of Universal Freemasonry,"
the "Prophet of Freemasonry" and the
"greatest Freemason of the nineteenth century."),
and one of the "high priests" of freemasonry.

He became a Convicted War Criminal in a
War Crimes Trial held after the Civil Wars end.
Pike was found guilty of treason and jailed.
He had fled to British Territory in Canada.

Pike only returned to the U.S. after his hand picked
Scottish Rite Succsessor James Richardon 33° got a pardon
for him after making President Andrew Johnson a 33°
Scottish Rite Mason in a ceremony held inside the
White House itself!]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,081
Latest member
AnyaMerry

Latest Threads

Top