[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

Moving Files KSHELL

Asked by devtha in Unix Systems Programming

Tags: setduperules

Hi here is my script I need some feedback. I am using AIX (kshell) version 4
Here is what I want to do. I want to poll a folder on the server for *.dat files. For each file I want to store its name in a variable and rename the file.
Then call a script . This script generates a file namely cleansedfile. I want to rename it to the name in the variable.
Then send it to other server in the internal network. Only working solution will be awarded points.
Thanks for viewing this.
------------------

tempfile_name  # declare a variable

loop 3 begin
  ftpconnect("oracle07", 229, "uid", "pwd");
  if(success eq ftpresult) begin
    exitloop;
  end else begin
    waitsecs(10);
  end
end

# Check if the ftpconnect command was successful.
# If the connect was not successful, print out an error
# message and end the script.
# NOTE: loop, if, and foreach statements must contain
#       enclosing "begin" and "end" blocks.

if(success ne ftpresult) begin
  print("ERROR: could not connect to server after 3 attempts");
  endscript;
end

# Set the desired local and remote paths
# NOTE: "local" and "remote" are keywords used to denote the local
#       and remote computers respectively.
# NOTE: Since "\" is also used as an escape character to specify
#       printable quotes, local paths may be specified using a
#       double backslash like "c:\\myfolder"

ftpsetpath(local, "..\tril6v0\\Projects\\dev\\demo\\");

if(success ne ftpresult) begin
  print("ERROR: could not set local path");
  ftpdisconnect();
  endscript;
end

ftpsetpath(remote, "\\oracle07\intfc\dj\sap\hr\");

if(success ne ftpresult) begin
  print("ERROR: could not set remote path");
  ftpdisconnect();
  endscript;
end

# If passive mode transfers are required, enable passive mode

enablepasv();

# List the contents of the remote folder. In order
# to be able to manipulate this list in the future,
# we store it in a variable.
# Any name can be chosen for this variable, but the first
# character must be "@". eg. @my_list

ftpgetlist(remote, @my_list);

if(success ne ftpresult) begin
  print("ERROR: could not list the contents of the current path");
  ftpdisconnect();
  endscript;
end

#print out the number of items that are in the list

print("The remote folder contains ", @my_list.count, " items");

# Set the transfer type to auto. Valid keywords are "ascii",
# "binary" and "auto".
# Also, set the rules to use if a duplicate file already exists
# in the destination path. The files may be compared by size or
# by date. This is indicated by the keywords "bysize" or "bydate".
# The following rule keywords may be specified: "resume", "rename"
# "overwrite", and "skip". Refer the help manual for the syntax of
# the "setduperules" macro.

settransfertype(auto);
setduperules(bysize, overwrite, skip, skip);

# We can now pick each item in the list and decide whether we
# need to download it. This is accomplished by the "foreach"
# statement. Any name can be chosen for the variable that denotes
# each individual item, but the first character must be "$".
# eg. $my_item
# For each item, check if it is a file. If so, check if the name
# matches the wildcard "*.txt". If so, download the file to the
# local folder, and delete it from the remote server.

foreach $my_item in @my_list begin
  if(false eq $my_item.isfolder) begin
    if("*.dat" eq $my_item.name) begin
      #ftpdownload(file, $my_item.name);
      #if(success eq ftpresult) begin
      #  #   ftpdelete(remote, file, $my_item.name);
      #end else begin
      #  print($my_item.name, " ", "could not be downloaded");
      #end
      tempfile_name = $my_item.name   #store the file name in a variable
      rn $my_item.name sap_file.dat   #rename the file to the projects required file name
      sap_demo.sh                     #call the other script that generates the file "cleansedfile"
      rn cleansedfile tmpfile_name    #rename the cleansed file to a variable name
      #now send this file to other server on the network.
    end else begin
      print($my_item.name, " ", "does not match *.dat");
    end
  end else begin
    print($my_item.name, " is a folder");
  end
end

# Finally, disconnect from the remote ftp server

ftpdisconnect();

# we can now finish the script. Since this script has been
# scheduled as a recurring task, it will be run again
# after 5 minutes.

endscript;
[+][-]08/28/03 11:02 AM, ID: 9242574Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/28/03 02:29 PM, ID: 9243927Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/03 07:56 AM, ID: 9248508Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/03 10:07 AM, ID: 9249467Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/02/03 04:59 AM, ID: 9266551Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/02/03 08:59 AM, ID: 9268184Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/02/03 11:15 PM, ID: 9272239Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/02/03 11:39 PM, ID: 9272338Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/03/03 07:07 AM, ID: 9276768Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/03/03 07:21 AM, ID: 9276977Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/09/03 01:05 PM, ID: 9323716Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/10/03 01:09 AM, ID: 9326931Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/10/03 12:29 PM, ID: 9331512Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/11/03 12:11 AM, ID: 9334903Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Unix Systems Programming
Tags: setduperules
Sign Up Now!
Solution Provided By: JustUNIX
Participating Experts: 4
Solution Grade: A
 
[+][-]01/18/04 05:39 AM, ID: 10140193Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/25/04 09:38 AM, ID: 10196082Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89