Spyke

Replies

linux

Comment on

Bash scripting question

You can do the entire thing as a one-liner using only find:

find ./ -type f \( -iname "*.jpg" -or -iname "*.png" \) -exec sh -c 'mv "$0" "$(uuidgen -r).${0##*.}"' {} \;  

Test on my machine:

phaedrus@sys76 ~/D/test> ls -lh  
total 0  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test1.jpg  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test1.png  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test2.jpg  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test2.png  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test3.jpg  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 test3.png  
phaedrus@sys76 ~/D/test> find ./ -type f \( -iname "*.jpg" -or -iname "*.png" \) -exec sh -c 'mv "$0" "$(uuidgen -r).${0##*.}"' {} \;  
phaedrus@sys76 ~/D/test> ls -lh  
total 0  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 062d8954-9921-42bd-ad24-0e4ed403a5db.jpg  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 111f859f-b1fe-4488-b2bc-75585320e3a3.png  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 39b9fe4e-7a05-43c9-b30a-69e9a13aa3a9.png  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 57bda91e-49e5-43fe-8318-aeeb2e3adde7.png  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 97398eb7-54aa-488f-8fbe-0b84b5e5a50d.jpg  
-rw-r--r-- 1 phaedrus users 0 Dec  6 01:08 f7a13274-e2c0-4fa7-9907-c590d1280c2e.jpg  

btw, Lemmy doesn't like language specifiers in the multi-line code blocks, so it's difficult to read all that in its current form since there are no tabs to know how you have it formatted. Makes it virtually impossible to troubleshoot your specific script.

edit: further reading on the ever useful variable expansions (${0##*.} portion of my one-liner):
https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

Comment on

Modding

Just then, a loud booming sound comes from the top of the Throat of the World: "TOOT TOOT." The hero gazes in horror as Thomas the Tank Engine comes barreling 'round the mountain pass.

news

Comment on

Font of ‘wasteful’ diversity: Trump’s state department orders return to Times New Roman

This reminds me of Reagan removing solar panels from the white house just to spite the libs. We spent good money installing those, and they only served to save money down the road. It probably took even more money to uninstall them with 0 benefits in doing so. Just leave it, literally is hurting nothing at all.

It really feels like all of this is just fire and movement to confuse those that are not paying attention, or unable to. Make it easier for the proles to land on the decision to bury their heads in the sand.

This administration is a master class in insecurity projection.

fuck_ai

Comment on

this is some sad shit

The creative iterations part is funny to me. Sure, it cuts the time-span of each iteration down, potentially, if you are not proficient with what you are doing. However, because of the wild innaccuracies and lack of context of a physical world, you are also doing 5-10x more iterations than you otherwise would have, except you don't get to learn and grow along the way.

Literally turns everything into worker-bee level stuff. Usual shareholder mentality to go for quantity over quality.