I need to get the paths of files and their parent directories in java from a given directory but not including it.
So for example, If my method was given the path: /home/user/test
as a path it would return the paths of all files in that directory and under it.
So if /home/user/test
had the sub folders: /subdir1
and /subdir2
each containing file1.txt
and file2.txt
then the result of the method would be 2 strings containing /subdir1/file1.txt
and /subdir2/file2.txt
And if subdir1
had a directory inside it called subsubdir
and inside that file3.txt
, then the string created for that file would be /subdir1/subsubdir/file3.txt
, and if there are further sub directories that would continue.
The idea is I just want the directory paths above the file but not the absolute path so only the directories AFTER the initial given path.
I know its a little confusing but I'm sure someone can make sense of it. Right now all I have is a recursive function that prints out file names and their absolute paths.
Any assistance on this?