thumbnail of bafkreif2zjyagjh3ttw2il2a7ir5ilv2xpg67fojgwbihrbelqhlnsxz6a.png
thumbnail of bafkreif2zjyagjh3ttw2il2a7ir5ilv2xpg67fojgwbihrbelqhlnsxz6a.png
bafkreif2zjyagjh3tt... png
(46.7 KB, 644x695)
thumbnail of bafkreiffh2qtdjf6ljnptikeljybcvnqtzj7byyafnhuin72cvn3vwzz6e.jpg
thumbnail of bafkreiffh2qtdjf6ljnptikeljybcvnqtzj7byyafnhuin72cvn3vwzz6e.jpg
bafkreiffh2qtdjf6ljnp... jpg
(38.94 KB, 500x181)
thumbnail of bafkreidshmhqlag63twvp6y4riie2llir67immbnqgbg2aihee35f5ej6i.png
thumbnail of bafkreidshmhqlag63twvp6y4riie2llir67immbnqgbg2aihee35f5ej6i.png
bafkreidshmhqlag63twv... png
(50.57 KB, 844x674)
thumbnail of bafkreifafpkvznvdevnm53rkcj6awssyo3aq55oiesi2ak35mehpwmiz6e.png
thumbnail of bafkreifafpkvznvdevnm53rkcj6awssyo3aq55oiesi2ak35mehpwmiz6e.png
bafkreifafpkvznvdevnm... png
(56.45 KB, 1879x327)
thumbnail of bafkreidxkg7pucqrxtqkyqnts72jpst6jxnfqm2eyqsfwzdgsabzwmxz6a.jpg
thumbnail of bafkreidxkg7pucqrxtqkyqnts72jpst6jxnfqm2eyqsfwzdgsabzwmxz6a.jpg
bafkreidxkg7pucqrxtqk... jpg
(31.4 KB, 531x506)
I emitted thousands of random extensionless files (incl. these 5). For certain reasons, I now want to add extensions to them. They are .gif, .png, .swf, etc.; use this:
find . -type f -not -name "*.*" -exec bash -c \
'if [ $(file --mime-type -b {})  "image/jpeg" ]; then mv {} {}.jpg; fi;' \;; \
find . -type f -not -name "*.*" -exec bash -c \
'if [ $(file --mime-type -b {})  "image/png" ]; then mv {} {}.png; fi;' \;; [...]Full command:
. ipfs://bafkreiap6ghxpyd7hx5cvy3xvebbf5zzn57zotq53wzjwnktgcebti72ee
. https://yukovskibot.com/wV6Ne-DGnCERDnCeFVm7XPhnRFhMB_g9nvcYwThutzY
. based on https://www.baeldung.com/linux/bash-add-file-extension

Problem with that (if you don't put the them in 1000-files folders or something):
> bash: line 1: [: too many arguments
So I can go back to my "crappy" solution which I wrote before I saw that baeldung.com page:
cat cids.txt | xargs -d "\n" bash -c 'for args do file /ipfs/$args | \
sed "s/,.*//g" | grep -v ": data$"; done' _ | xargs -d "\n" sh -c \
'for args do in=$(echo $args | sed "s/:.*//g"); ext=$(echo $args | \
sed "s/ image data//g" | sed "s/.* //g" | sed "s/GIF/gif/g" | \
sed "s/JPEG/jpg/g" | sed "s/PNG/png/g"); echo -n "$in "; \
echo $(echo $in | sed "s/.*\///g").$ext; done' _It doesn't have that too-many-args problem because it's streamed and not all at once. Or do this for jpg+gif+png:
find . -type f | xargs -d "\n" bash -c 'for args do tb=$(head \
-c 3 "$args" | xxd -p); if [ "$tb"  "ffd8ff" ]; then mv -n "$args" \
"$args.jpg"; fi; if [ "$tb"  "474946" ]; then mv -n "$args" "$args.gif"; \
fi; if [ "$tb" == "89504e" ]; then mv -n "$args" "$args.png"; fi; done' _That's based on the first bytes of files and not MIME type as determined by this program: file version 5.41. With file-5.41, I can add .txt; can't easily do that with top bytes.

 >>/10547/
> I've found hidden gems on those from that unsurpassed creative drive.
Made me check something - this YouTube video which has 4 likes in Twibooru
https://twibooru.org/3229570?q=derpibooru_id:3365361

I was thinking it was from
> ./True_Blue_UCnjNrJw4IIhORvMJVqYuM0Q.partial/
but it's actually from
> ./AndyFish_UCTCfI5U98rsJ8VdNF3K_uUQ/Dolores_Umbridge_-_Sieg_Heil-AndyFish-20151211-youtube-1920x1080-HL9LkTgHAaA.webm
in here (BTW, ipfs daemon got oom'd when there was around 80 MiB of free RAM):
> https://gateway.pinata.cloud/ipfs/QmXNifFze1xzMUbCpekpP9V5KxncGnAi4v8wU8655uD7iY/?filename=AndyFish_UCTCfI5U98rsJ8VdNF3K_uUQ