Operating System - Linux
1829556 Members
1816 Online
109992 Solutions
New Discussion

Re: FTP Scripting in RHAS 2.1

 
Jorge Cocomess
Super Advisor

FTP Scripting in RHAS 2.1

Greetings,

I am facing this challenge and I don't know why it doesn't work and I hope someone here will be able to help me. My current FTP script is working fine when it's only looking for '*txt' - I must change how it was looking for every file end with *txt, but now focus on just one specific file
'Myfile20060601AABB.txt' - This is what set to do:
FILE='Myfile*2006'$DATE*

By tsting, I create a file Myfile20060601.txt and run my script and I get nothing.

Does anyone know what's the correct syntax for selecting just one specific file with a script??

Please help!!

J
8 REPLIES 8
Abdul Kaleem Khan
Occasional Advisor

Re: FTP Scripting in RHAS 2.1

Script

$ cat test
DATE='0601'
FILE='Myfile*2006'$DATE*
echo "This is file name : $FILE"
cat $FILE
$

Files in the directory
$ ls
Myfile20060601AABB.txt Myfileww20060601AABB.txt Myfileww20060601ghgh test

When i run the script I can print all the files
$ ./test
This is file name : Myfile*20060601*
a
b
c
d
e
f
abdul1
abdul2
$

Now you need to tell me that what is the correct file name convention you having and what exact file name you want to select?
Jorge Cocomess
Super Advisor

Re: FTP Scripting in RHAS 2.1

Hi,

I Should have included the full script for you to see. Within the script, I am also dealing with the group permission as well. Like I've siad before, everything is working according to want they want before. The scope has changed a little bit by asking me to only pull down the certain files. Of course, it just happened that all the files are ended with a .txt extension.

The script has been attached.

Thanks for your help.

J
Jorge Cocomess
Super Advisor

Re: FTP Scripting in RHAS 2.1

Here's an updated script to show what I'm trying to do. When I exceute this script, I get nothing but ran without any issues. However, it did not create a time stamp in my log either.

Does anyone has any ideas??

Please help!!

J
Abdul Kaleem Khan
Occasional Advisor

Re: FTP Scripting in RHAS 2.1

Check Line no 8:

FILE=FILE='Myfile*2006'$DATE*
Jorge Cocomess
Super Advisor

Re: FTP Scripting in RHAS 2.1

My fault. I was in the hurry of cut & paste. The original test script had the right syntax. Even with the right syntax, the script could not find any files with the right file name. All I would like to do is to modify how it was pulling the *.txt files, but now pulling only Myfile2006AABB.txt file instead.

Any ideas?

Thanks,
J
Steven E. Protter
Exalted Contributor

Re: FTP Scripting in RHAS 2.1

Shalom,

Please run the sript with the following line as its first line of code after the shell is set.

set -x

Also, make sure you set the shell

#!/bin/sh

or

#!/bin/bash

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jorge Cocomess
Super Advisor

Re: FTP Scripting in RHAS 2.1

No help here. I found another solution for this issue. Closing the thread.
Jorge Cocomess
Super Advisor

Re: FTP Scripting in RHAS 2.1

The thread closed as of 6/7/2006