If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > I need your opinion

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-04, 11:23
mvillan mvillan is offline
Registered User
 
Join Date: Dec 2003
Location: Ogden Utah
Posts: 34
Thumbs up I need your opinion

I would appreciate your comments on the script below. I have a need to time stamp the files that I am bringing in from another server and maintain the integrity of their unique naming convetion . So, after the ftp session is completed I go to the directory where the files are at and use the for loop and cat command to append a time stamp to all the files within the directory and them remove the original file. Is there a shorter or better way of doing this? I do not want to do it during the ftp session...is this ok or do you guys prefer to do it during the ftp session? It would be great to just be able to append the time stamp without concatenating. Looking forward to your replies.

*************************************
easy_cat=/files/in/directory/[A-Z0-9] *
in = /files/in/directory

if [ -f $easy_cat ]; then
cd $in
for i in $easy_cat
do
cat $i > $i.$DTTM
rm $i
done

else

exit
f
__________________
mvilla
Reply With Quote
  #2 (permalink)  
Old 07-14-04, 11:44
deebee deebee is offline
Registered User
 
Join Date: Jul 2004
Posts: 45
I would suggest, If you're automating FTP process, then you can do it along with that! so that whole process would take place at a stretch! sounds good?
Reply With Quote
  #3 (permalink)  
Old 07-14-04, 12:04
mvillan mvillan is offline
Registered User
 
Join Date: Dec 2003
Location: Ogden Utah
Posts: 34
ftp

any suggestion on how to do it through ftp.
__________________
mvilla
Reply With Quote
  #4 (permalink)  
Old 07-14-04, 13:58
deebee deebee is offline
Registered User
 
Join Date: Jul 2004
Posts: 45
read username
read password
ftp -n -v myRemoteServer <<END_SCRIPT
user $username $password
lcd theLocalHostDirectory
bin
prompt
cd theRemoteDirectory
mput *
bye
END_SCRIPT
#add ur script after this
#rename files
...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On