Code: Select all
#ls /tmp/*%*
/tmp/aaa%20a.txt /tmp/bbb%20b.txt /tmp/ccc%40c.txt
#change.sh /tmp/
# ls /tmp/
aaa\ a.txt bbb\ b.txt ccc%40c.txt
MfG, Klopskuchen
Code: Select all
#ls /tmp/*%*
/tmp/aaa%20a.txt /tmp/bbb%20b.txt /tmp/ccc%40c.txt
#change.sh /tmp/
# ls /tmp/
aaa\ a.txt bbb\ b.txt ccc%40c.txt
Code: Select all
#!/bin/bash
find . -iname "*[%20]*" -depth -print | \
awk '
{
match ($0,/.*\//)
name = substr ($0,RLENGTH+1)
pfad = substr ($0,1,RLENGTH)
gsub (/$20/," ",name)
print "mv '\''" $0 "'\'' '\''" pfad name "'\''"
}' | cat
Code: Select all
find . -name "*%20*" -depth -print
Code: Select all
gsub (/$20/," ",name)
Code: Select all
#!/bin/bash
find . -name "*%20*" -depth -print | \
awk '
{
match ($0,/.*\//)
name = substr ($0,RLENGTH+1)
pfad = substr ($0,1,RLENGTH)
gsub (/%20/," ",name)
print "mv '\''" $0 "'\'' '\''" pfad name "'\''"
}' | cat