I am having the following directory structures:
~/mydir/dir1/f1.jpg
~/mydir/dir1/f2.jpg
~/mydir/dir2/f3.jpg
~/mydir/dir2/f4.jpg
~/mydir/dir2/f5.jpg
~/mydir/dir2/f6.jpg
~/mydir/dir3/f7.jpg
i.e. directory (mydir
) is having many subdirectories which in turn have many images in them. dir1
, dir2
etc does not have any more subdirectories.
I am looking for a script (any language, shell, python etc) which can produce the output like:
<absolute path of f1.jpg> dir1
<absolute path of f2.jpg> dir1
<absolute path of f3.jpg> dir2
.
.
<absolute path of f6.jpg> dir2
<absolute path of f7.jpg> dir3
i.e. full absolute path of all the files in all the directories in mydir, followed by a space and then that file's directory (i.e. which last directory that file is in).
I am using find . -name \* -print
to get the recursive file list but I am not sure how to get the exact output as desired.