Save all Temporary PDF-Files from Chromium

Sometimes a file – and in that case always an important one – is not reachable anymore with your browser (paywall, internet access, etc.) in this case it is always nice to know how to recover temporary files.

After some stack overflow / exchange searching and piping everything together here a simple solution to find the temp files from chromium:

cd Downloads
mkdir tmp
cd tmp
find ~/.cache/chromium -type f -exec file {} + | grep PDF | sed 's/ *:.*//' | xargs -I{} cp "{}" ~/Downloads/tmp
ls -a

This creates a folder tmp inside the download directory searches the cache of chromium, checks if it is a pdf [source], removes any unnecessary things from the grep output with sed [source] and finally copies everything in the created folder with cp [source].

Note: alle files have a file name without extension and are continuous numbered. Hence, the name has no relation to the content.

Advertisements