I'm trying to 7zip and move some files that look like this:
./[1998] - This year's book.pdf
##note the brackets, spaces, and apostrophes
My script looks like this:
for file in `ls ./unprocessed/*.pdf`;
do
7z a -mx=0 -pMyPassword $file.7z $file ;
mv $file ./processed
done
(This is actually on Synology's linux, if it makes a difference.)
I've tried adding quotation marks around "$file", but that doesn't help on either of the two main lines.
I'm hoping I can do this without a lot of complicated grep or sed type stuff.
The main error I'm getting is that it's trying to split out the file names due to the spaces, and freaks out because it can't find "[1998]", etc.
I think 7z will be okay with it, once I work out the spaces/funky chars issue(?).
Has anyone else run into this?
Appreciate any advice!