Sorry for double post
Dont know if any UT players out there but I'm looking for a script to move downloaded files into the proper dirs, aka a cache cleaner.
Someone gave me a script but doesnt work:
Code:
#!/bin/sh
target=/mnt/str/ut
cmd="mv -v"
cd ~/.loki/ut/Cache || exit 1
echo '[Cache]' > cache.ini.new
cp cache.ini cache.ini.bak.$$ # never know.. ;)
grep '=' cache.ini | awk -F '=' -v cmd="$cmd" -v target="$target"
function moveit(fromhere, tothere)
{
tothere="""target""tothere""";
print "[ -f "tothere" ] && echo \ \ \ "tothere" already there! || "cmd" ""fromhere".uxx" "tothere | "sh";
}
{
#print $1" "$2; # testing
else if(match($2,".unr$")) { moveit($1, "/Maps/"$2 ); }
else if(match($2,".umx$")) { moveit($1, "/Music/"$2 ); }
else if(match($2,".uax$")) { moveit($1, "/Sounds/"$2 ); }
else if(match($2,".u$")) { moveit($1, "/System/"$2 ); }
else if(match($2,".utx$")) { moveit($1, "/Textures/"$2 ); }
else printf $1"="$2"n" >> "cache.ini.new";
}
END { close("sh") }'
mv cache.ini.new cache.ini
keeps giving awk usage printout and shows error in function:
./cacheconv: line 11: syntax error near unexpected token `fromhere,'
./cacheconv: line 11: `function moveit(fromhere, tothere)'
unfortunately I havent much experience with shell scripting so apart from editing it to show my dir structure I can do little else here