Place 300 filenames into .txt file with the two preceding parent folders

Viewed 38

I want to place 300 filenames into a .txt file with the preceding 2 parent folders.

i.e. folder2/folder1/filename > .txt

I cannot use PWD as it prints out full path.

thanks!

EDIT:

I'm using the script below to loop through ls:

for item in $(ls); do pwd | awk -F/ '{print $6"/"$7"/"$8"/"}' printf $item done;

My result:

highway1_frame_001853.jpgdata/highway1/highway1Images/

It is close but I have the filename before the directory.I need it after... NEW to scripts...thanks for the help.

0 Answers
Related