I have a relatively simple script which looks at a directory for all files that have an extension of .webctl, which is an ftp script to send a file of the same name but the extension of .txt to another computer. I have pasted the script below...
for i in `ls /tmp/orderout/*.webctl`
do
/usr/bin/ftp -vn < $i > /dev/null 2>&1;
/bin/mv $i /tmp/orderout/sent
done
Here is an example directory listing:
file1.webctl
file1.txt
file2.webctl
file2.txt
file3.webctl
file3.txt
And so on...
My problem is that after the ftp command finishes, I need to move both the .webctl AND the .txt file to the sent directory. My question is this, how do I extract just the first part of the file, (file1, file2, file3 in the examples above) and append .txt to it so that I can move that file as well as the .webctl file? Is there some sort of split command that I can use, or perhaps I need to use perl?
Any help would be MOST appreciated!
Thanks,
Panthaur
for i in `ls /tmp/orderout/*.webctl`
do
/usr/bin/ftp -vn < $i > /dev/null 2>&1;
/bin/mv $i /tmp/orderout/sent
done
Here is an example directory listing:
file1.webctl
file1.txt
file2.webctl
file2.txt
file3.webctl
file3.txt
And so on...
My problem is that after the ftp command finishes, I need to move both the .webctl AND the .txt file to the sent directory. My question is this, how do I extract just the first part of the file, (file1, file2, file3 in the examples above) and append .txt to it so that I can move that file as well as the .webctl file? Is there some sort of split command that I can use, or perhaps I need to use perl?
Any help would be MOST appreciated!
Thanks,
Panthaur