After a scan disk i have a lot of CHK-files in folders like "found.000", ...
I can find out the extensions with the file command:
for i in /media/Daten/found.*/*.chk ; do file $i; done
how can I use this to reconstruct all file extensions to these files?
This technique WILL NOT WORK FOR ALL FILES. I used to use this to help with data recovery.
The way this works is it uses the mime type functionality in the
file
command then greps /etc/mime.types for it, picks the first extension in the list and then renames the file to that.This command will do mass renames, it will move first and ask questions later, so be 100% sure you're running this on the correct directory.
Next time, do not use chkdsk to recover files. You can damage them beyond repair. chkdsk will OM NOM NOM your data and burp afterwards. Always use recovery software to get back the files you need before you chkdsk.
Generally, the files are named .CHK though, not .chk (just fyi.)