I have an array (pfad) containing a filepath as a string f.e. (got it with tree and some sed stuff)
/media/usb1/Filme/Jersey\ Boys\ (2014)/review.txt
I want to delete this file:
rm ${pfad[$j]}
Obviously this doesn't work, because we don't have the correct format to access directorys with spaces. I figured out it should be like this:
rm /media/usb1/Filme/Jersey\ Boys\ \(2014\)/review.txt
So I am missing '\' twice. once in front of "(" and once behind "2014". How can I adjust this?
I guess it's possible to replace (2014) with \(2014\) via sed, but that is pretty sloppy and I I had to do it for every year.
If there is a better way to get the absolute full path (and size) of every file in a directory and its subfolders in two (or one) arrays, I woud like to learn. I am free to use perl / ruby or what ever Raspbian has to offer. (Would be nice if it is kinda ressource friendly.) Thanks for reading.
EDIT (my) workaround:
use tree -N it creates the output without " \ ". after that put the variable (array) as mentioned in the comments in "$variable".
