Hi,
I'm writing a script which actually sftp's(gets!! i'm using mget) files from a windows box to unix server. (i've gone thru forum and got pretty good answers, Thx for that).
but the windows box to which i'm ftp'g prompts for a password change every 30 days. so please suggest me how to do this.
also based on file name i need to ftp files to a different location, for example..
if file name is xxx0173.052305 then i need to read this name and according to whats in place of 173 i need to push it to a specific folder say d173 or if its 125 the file should go to d125.
Thanks in advance all..
The first problem is not easy, but second one is:
filename="xxx0173.052305"
print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/' # will yield "173"
# hence (we assume the variable $filename to be there):
typeset chFileSig="$(print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/')"
mv $filename /path/to/dir/d${chFileSig}
Hope this helps.
bakunin
yeah thats one way of doing it !!... but the file name is to be taken from the directory and not hardcoded.
I need to pick file names with extention of today's date... for example ".051201" so how do i pick up these files...?
#!/bin/ksh
today="$(date +%m%d%y)"
for filename in *.${today}
do
print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/' # will yield "173"
# hence (we assume the variable $filename to be there):
typeset chFileSig="$(print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/')"
mv "$filename" "/path/to/dir/d${chFileSig}"
done