I need to remove all the available parents for a file. For example, I have "c: \ users \ There is a file like admin \ Downloads \ 1 \ 2 \ 3 \ 4 \ 5 \ test.stub ", I need to add a parent to the list of files, in which it is:
c : \ Users \ admin \ downloads \ 1 \ 2 \ 3 \ 4 \ 5 \ c: \ users \ admin \ Downloads \ 1 \ 2 \ 3 \ 4 \ c: \ users \ administrator \ download \ 1 \ 2 \ 3 \ ... c: \
Any ideas how can I?
Thank you in advance,
Flow
Try it out:
file f = new file ("C: \\ users \\ admin \\ download \\ 1 \\ 2 \\ 3 \\ 4 \\ 5 \\"); While (getParent ()! = Null) {System.out.println (f.getPath ()); F = f.getParentFile (); }
returns the path to the parent directory (or zero if no originals). File as the file
parent to the directory.
Resources:
Comments
Post a Comment