User:Simpsons Dumper/handy commands

From The VG Resource Wiki
< User:Simpsons Dumper
Revision as of 23:32, 22 September 2019 by Simpsons Dumper (talk | contribs) (A copy of my "handy commands" text file. For use with the Linux terminal, complete with example names from whatever I was working on when I added these to my file.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A copy of my "handy commands" text file. For use with the Linux terminal, complete with example names from whatever I was working on when I added these to my file.

bulk remove from name:
rename 's/data_00//g' *

name to sequential numbers:
ls | cat -n | while read n f; do mv "$f" `printf "%03d.wav" $n`; done

rename with extras:
for f in *; do mv -- "$f" "PRE_$f_SUF"; done

rename non-zero-padded to zero-padded:
for f in *; do mv "$f" "`printf %03.f ${f//[!0-9]/}`".wav; done

name directories to sequential numbers:
#!/bin/bash

for d in voicetest/*/
do
     (cd "$d" && ls | cat -n | while read n f; do mv "$f" `printf "%03d.wav" $n`; done)
done

cleanup files in directories:
rm */*.bcwav

delete duplicates:
fdupes -rdN .

list duplicates:
fdupes -r .

zip with directory:
zip -r willie.zip Simpsons\ Skateboarding/Willie/

zip with directories:
#!/bin/bash

for d in The\ Simpsons\ Game/Voice/*/
do     
	IFS='/'; arr=($d); unset IFS;
	zip -r "${arr[2]}.zip" "$d"
done

convert all audio in directory:
find -name "*.sndS" -exec bash -c 'sox -t raw -r 22050 -b 8 -c 1 -L -e unsigned-integer "{}" "${0/.sndS}.wav" trim 0.0004' {} \;

skeelton:
ffmpeg -i MAHB.MNG -vf "scale='min(2048,iw)':min'(2048,ih)':force_original_aspect_ratio=decrease,pad=2048:2048:(ow-iw)/2:(oh-ih)/2:gray" out/%d.png
for f in out/* ; do convert "$f" -trim +repage "$f" ; done

big bulk:
echo *.rgb | xargs -n 100 wine tstoimg.exe --rgb2png