Shl script to ftp a file

I have to write a shl to ftp a file from a directory to UNIX, the problem is that the file not always have the same name
in the server: \\OCELOT\VOL1\ORGS\FINANCIAL AID\CSS\0910 Data\loaded idocs\3526_331322.dat>
The filenames are, for example, 3526_332840.dat, where 3526 is constant, and 332840 is a sequential number which is always a couple hundred
I used this script before, but I knew the exact name of the file...
#! /bin/sh
# Script: idoc_ftp.shl
# Author:
# Date:     05/11/2009
# Purpose:
#   Via FTP to retieve the file that is dowloaded from the IDOC wEBSITE
#   and move it to the UNIX directory cd/U02/sct/banner/bandev2/xxxxxx/data_files/name???
# Comments:
#   Remote user "ftp_ban_jl" is set to automatically open to folder (directory)
#     OCELOT\VOL1\ORGS\FINANCIAL AID\CSS\0910 Data\loaded idocs\3526_331322.dat>
# Directory Location for script:
#     Database Home Dir/xxxxxxx/shl
# Special Notes:     This shell script is called from jypdpjn
# Modifications:
#  Date           Author 
# set job number and user
JOBNUM=$ONE_UP;
USER=$BANUID;
##USER=$UID;
JOB_NAME=$PROC
MPATH=$BANNER_HOME;
UpLoadFileName="???????";
LocalDir="${MPATH}/xxxxxy/dat_files";
RemoteHost="nwftp.xxxxxx.edu";
RemoteUser="ftp_ban_jl";
RemotePass="xxxxxx[";
RemoteDir="dept";
TMode="ascii"; # Transfer mode
# set log name and directory path
LPATH="/u02/sct/banjobs/"
LOG_FILE_NAME="${JOB_NAME}_ftp_${USER}_${JOBNUM}.log";   
LF1=${LPATH}${LOG_FILE_NAME};
LF2=${LPATH}${LOG_FILE_NAME};
# write header lines to job log
echo "${JOB_NAME} " >>${LF1} 2>>${LF2}
echo "jrn_load_dept_ftp.shl" >>${LF1} 2>>${LF2}
echo " " >>${LF1} 2>>${LF2}
echo "Running Date & Time: " >>${LF1} 2>>${LF2}
date  >>${LF1} 2>>${LF2}
echo " " >>${LF1} 2>>${LF2}
echo "Starting script   " >>${LF1} 2>>${LF2}
echo " " >>${LF1} 2>>${LF2}
#=================================================================================#
# Change dir to where the ftp will place the uploaded file
cd ${LocalDir}
if test $? -eq 0
then
  echo " " >>${LF1} 2>>${LF2}
  echo "Successfully changed dir " >>${LF1} 2>>${LF2}
  echo "${LocalDir}" >>${LF1} 2>>${LF2}
  echo " " >>${LF1} 2>>${LF2}
else
  echo " " >>${LF1} 2>>${LF2}
  echo "Error: could not change dir ">>${LF1} 2>>${LF2}
  echo "${LocalDir}" >>${LF1} 2>>${LF2}
  echo " " >>${LF1} 2>>${LF2}
  echo "Script Ended and no FTP done." >>${LF1} 2>>${LF2}
  exit 1
fi
# Initiate the FTP process
# Loop through remaining parameters to create ftp commands.
# Enter user-name and password in host machine
echo "user $RemoteUser $RemotePass"
# Set transfer mode
echo $TMode
# Change directory in remote machine
echo cd $RemoteDir
# Change local directory in local machine
### echo lcd $LocalDir
# Transfer file
echo get $UpLoadFileName
# End ftp session
echo quit
) | ftp -vin $RemoteHost >>${LF1} 2>>${LF2}
# End of FTP Process
if test $? -eq 0
then
  echo "Successfully executed FTP"  >>${LF1} 2>>${LF2}
else
  echo "Error: could not execute FTP" >>${LF1} 2>>${LF2}
  echo " " >>${LF1} 2>>${LF2}
  echo "Script Ended." >>${LF1} 2>>${LF2} 
  exit 1
fi
echo " " >>${LF1} 2>>${LF2}
echo " " >>${LF1} 2>>${LF2}
echo "End Date & Time: " >>${LF1} 2>>${LF2}
date  >>${LF1} 2>>${LF2}
echo " " >>${LF1} 2>>${LF2}
echo "Completed Shell Script." >>${LF1} 2>>${LF2}Edited by: user648177 on May 12, 2009 11:08 AM

It's on a windows server, is there any reason not to use samba?
FTP is painstakingly and the scripts break easily. If you just mount the windows share on your linux server, there's no need to transfer them, their available!
I know this doesn't resolve the question you've got, but using a samba mount the whole script is obsolete.

Similar Messages

  • Shell Script- To FTP the latest file with the date stamp

    I have a Solaris 10 based system, where it generate some application files (multiple) in XML format and the file name comprises of the current date.
    File Format is as follows;
    CX-FIL-20070624000000-2-8452536d-000133.xml
    Where 20070624 repesents the curent date of the file
    I want to FTP these files to another server (Solaris 10 based Sun Machine) by comparing the file name with the current date.
    Please let me know how I can do this by using a shell script.

    Assuming you want to ftp the files with today's datestamp, you could match the files you want like so:
    CX-FIL-`/bin/date +"%Y%m%d"`*
    Use that in your script to generate the file list to be transferred...
    -Rob

  • Script to copy current files from one folder to another and to FTP it to a another server

    I have created a simple script that copies the file, but doesn't give me only the current day file.  I'm not sure what I'm doing wrong.
    :: @echo off
    setlocal
    :: Checking for production cluster
    if not exist e: exit
    date /t
    for /f "tokens=1-4 delims=/ " %%A in ('date /t') do (
       set M=%%B
       set D=%%C
       set Y=%%D)
    xcopy E:\ACHDlrPPcsvDownload\*-%Y%%M%%D%*-GMACTEST.csv /y E:\ACHDLRCSV
    pause
    endlocal
    I also want to ftp this file to another server. I've tried the basic FTP command but it doesn't work.

    Here is a more reliable method of extracting the date.
    @echo off
    :: Checking for production cluster
    if not exist e: exit
    set M=%date:~4,2%
    set D=%date:~7,2%
    set Y=%date:~10,4%
    set target=%Y%%M%%D%
    @echo E:\ACHDlrPPcsvDownload\*-%target%*-GMACTEST.csv /y E:\ACHDLRCSV
    xcopy E:\ACHDlrPPcsvDownload\*-%target%*-GMACTEST.csv /y E:\ACHDLRCSV
    Look at the command being echoed to validate the filename template.  Try it at a prompt.
    ¯\_(ツ)_/¯

  • FTP log file generation failed in shell script

    Hi ALL,
    I am doing FTP file transfer in shell script and able to FTP the files in to corresponding directory , But when i am trying to check the FTP status through the log files then its giving problem . please check the below code.
    for file in $FILENAME1
    do
    echo "FTP File......$file"
    echo 'FTP the file to AR1 down stream system'
    ret_val=`ftp -n> $file.log <<E
    #ret_val=`ftp -n << !
    open $ar1_server
    user $ar1_uname $ar1_pwd
    hash
    verbose
    cd /var/tmp
    put $file
    bye
    E`
    if [ -f $DATA_OUT/$file.log ]
    then
    grep -i "Transfer complete." $DATA_OUT/$file.log
    if [ $? -eq 0 ]; then
    #mv ${file.log} ${DATA_OUT}/../archive/$file.log.log_`date +"%m%d%y%H%M%S"`
    echo 'Log file archived to archive directory'
    #mv $file ${DATA_OUT}/../archive/$FILENAME1.log_`date +"%m%d%y%H%M%S"`
    echo 'Data file archived to archived directory'
    else
    echo 'FTP process is not successful'
    fi
    else
    echo 'log file generation failed'
    fi
    its giving syntax error end of file not giving the exact line number , please help me on thsi
    Regards
    Deb

    Thanks for ur reply
    Actually i did a mistake in the code i wrote the following piece of code below
    ret_val=`ftp -n> $file.log <<E
    #ret_val=`ftp -n << !
    so after the tilde symbol it as again taking the '# ' as a special character so it was giving error, so i removed the second line now its working fine.

  • Ftp get file without extension

    Hi
    I'm trying to use the sample code from http://blog.dbandbi.com/tag/ssis-script-task-check-if-file-exists-c/
    public void Main()
    string userName = Dts.Variables["User::userName"].Value.ToString();
    string password = Dts.Variables["User::password"].Value.ToString();
    string fileName = Dts.Variables["User::fileName"].Value.ToString();
    string ftpURL = String.Format("ftp://ftp.dbandbi.com/public_ftp/incoming/{0}",fileName);
    try
    FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(ftpURL);
    ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;
    ftpRequest.Credentials = new NetworkCredential(userName, password);
    using (FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse())
    Dts.Variables["User::isFileExists"].Value = true;
    catch
    Dts.Variables["User::isFileExists"].Value = false;
    Dts.TaskResult = (int)ScriptResults.Success;
    but I'm having problems because the files are in unix format and they don't have extension. I  tried using filename*.* and filename*  but I always get "file does not exist".  What I'm trying to do is to know if the file created by
    another process has been freed so I can download it.
    thanks in advance
    cognosoft

    If no extension then check for the exact name. It must not matter. When you connect to the site using non SSIS facilities, do you see the file there? Wildcards do not work AFAIK.
    Basically, you need a directory listing to determine what files exist. You can run a remote dir command and save its output to a file or variable to skim thru.
    Arthur My Blog

  • BEA-000000 [IPT_FileRecMonitorError] Error in ftp or file receiver monit

    JDeveloper 11.1.1.2
    FusionOrderDemoR1PS1
    Dear Experts,
    My managed server soa_server1 keep logging the above subject error after suceesfully running the 5 ant scripts in the following document:
    [Tutorial for Running and Building an Application with Oracle|http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10275/run.htm#CACGJAJE]
    SOA Suite
    11g Release 1 (11.1.1)
    E10275-02
    Please advice,
    pino
    log:
    {noformat}
    <oracle.soa.services.notification> <BEA-000000> <<.> Notification via email, voice, SMS or IM will not be sent. If you would like to enable them, please configure corresponding sdpmessaging driver. Then modify the accounts and set NotificationMode attribute to either NONE, EMAIL or ALL in workflow-notification-config.xml> <12-Jan-2010 10:52:02 o'clock AST> <Warning> <oracle.soa.services.notification> <BEA-000000> <<.> Notification via email, voice, SMS or IM will not be sent. If you would like to enable them, please configure corresponding sdpmessaging driver. Then modify the accounts and set NotificationMode attribute to either NONE, EMAIL or ALL in workflow-notification-config.xml> ==> CubeEngine deploy OrderProcessor took 0 seconds ==> CubeEngine deploy InternalWarehouseService took 0 seconds INFO: DeploymentEventPublisher.invoke Publishing deploy event for default/OrderBookingComposite!1.0*8f72a2e5-e18c-4210-a406-248ecc9d83aa <12-Jan-2010 10:52:07 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:07 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> INFO: SSLSocketFactoryManagerImpl.getKeystoreLocation SOA Keystore location: C:/Oracle/MIDDLE~1/USER_P~1/domains/SOA_DO~1/config/fmwconfig/default-keystore.jks INFO: SSLSocketFactoryManagerImpl.getKeystorePassword Obtained null or empty keystore password INFO: SSLSocketFactoryManagerImpl.getKeyPassword Obtained null or empty key password INFO: SSLSocketFactoryManagerImpl.getSSLSocketFactory Could not obtain keystore location or password ==> CubeEngine deploy ExternalPartnerSupplier took 0 seconds INFO: DeploymentEventPublisher.invoke Publishing deploy event for default/PartnerSupplierComposite!1.0*101e2b6d-1e45-4dd4-b4e3-e441b4da2562 INFO: SSLSocketFactoryManagerImpl.getKeystoreLocation SOA Keystore location: C:/Oracle/MIDDLE~1/USER_P~1/domains/SOA_DO~1/config/fmwconfig/default-keystore.jks INFO: SSLSocketFactoryManagerImpl.getKeystorePassword Obtained null or empty keystore password INFO: SSLSocketFactoryManagerImpl.getKeyPassword Obtained null or empty key password INFO: SSLSocketFactoryManagerImpl.getSSLSocketFactory Could not obtain keystore location or password ==> CubeEngine deploy B2BOrderProcessingEngine took 0 seconds INFO: DeploymentEventPublisher.invoke Publishing deploy event for default/B2BX12OrderGateway!1.0*f3185dc3-2691-422a-8119-bf69d902a809 INFO: FabricProviderServlet.stateChanged SOA Platform is running and accepting requests <12-Jan-2010 10:52:16 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:16 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:17 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:17 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:22 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:22 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:33 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:33 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.> <12-Jan-2010 10:52:33 o'clock AST> <Error> <oracle.soa.b2b.transport> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.>
    {noformat}

    I am also getting the same error.
    ####<Mar 18, 2010 10:36:59 PM PDT> <Error> <oracle.soa.b2b.transport> <obie-as1> <WLS_SOA1> <weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@2a5eaf0e> <<anonymous>> <> <> <1268977019632> <BEA-000000> <[IPT_FileRecMonitorError] Error in ftp or file receiver monitor.>
    I am running the SOA demo application. http://obie-wls-vip2:8001/StoreFrontModule/faces/login.jspx doesn't show the artifacts.
    I don't know whether the"Error in ftp or file receiver monitor" is related to the arifacts issue.

  • Need  Shell Script  for picking the files

    Hi,
        I want to write a shell script for piking the files in a sequence order (according to filename with time stamp)  from the sorce FTP server ..
                     Requirement is  in the source directory I'm getting files (Jain_1.xml  , Jjain_2.xml, Jain_3.xml .. ect..)  at  present my file adapter is picking all the files at a time  but  i want to pick  one by one... that to first i want to Jain_1.xml  after finish the processing of the file then only my file adapter should  pick the next file ( Jain_2.xml )  .
                  so..  all the forum mates suggest me to write a shell script..  but where  i have to write the s hell script. and where i have to deploy this script.... my Xi is running on UNIX ... so please sugest me  the procedure ...
    Regards
    Jain

    Hi,
    Why dont you use the option EOIO in which files will be picked up in order and will be proccessed in sequence....one after another....
    Regards,
    Sreeni.

  • FTP a file to given mailbox loacted at ip-address and port number

    I need technical suggestion on the following.
    Actually I got struck up with a technical issue related to FTP a file to UNIX mailbox through ABAP.
    We have tried with FM: SXPG_CALL_SYSTEM and FTP_CONNECT, which all works purely based on IP, USER ID and PWD.
    But we have an extra PORT NUMBER, which any of this FM doesnu2019t take up.
    Can you please suggest me any other FM that I can use to FTP a file to specified IP with Port Number along with User id and PWD.
    Else are we supposed to go for a separate script for this purpose?
    As i have no clue on UNIX, if i go for a script than what would be the reuirement for this script and where to place them and how to call them in to my ABAP?
    Timely help would be appreciable.
    Thanks in advance
    Edited by: yamuna pillai on Nov 11, 2008 8:37 AM

    Hi Yamuna,
    Can you let us know hw u did this..because we are facing the same kind of issue.
    Thanks
    Gayathri

  • How to FTP a file from client machine to database server using forms 10g

    Hi
    I want to ftp a file from a client machine to the database server machine using forms 10G (or PL/SQL).
    could you please tell me how can I do this
    Regards

    hi
    How to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
    Solution
    Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
    here are steps to get a small test form running, using WebUtil 1.06.
    Note: Oracle_Home is used as an alias for your real oDS ORACLE_HOME.
    Feel free to copy this note to a text editor, and do a global find/replace on
    Oracle_Home with your actual value (no trailing slash). Then it is easy to
    copy/paste actual commands to be executed from the note copy.
    1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
    and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
    2) Copy or move jacob.jar and jacob.dll
    C:\webutile is the folder where you extracted Jacob, and will end in ...\jacob_18
    cd C:\webutile
    copy jacob.jar Oracle_Home\forms\java\.
    copy jacob.dll Oracle_Home\forms\webutil\.
    The Jacob staging area is no longer needed, and may be deleted.
    3) Sign frmwebutil.jar and jacob.jar
    Open a DOS command prompt.
    Add Oracle_Home\jdk\bin to the PATH:
    set PATH=Oracle_Home\jdk\bin;%PATH%
    Sign the files, and check the output for success:
    Oracle_Home\forms\webutil\sign_webutil Oracle_Home\forms\java\frmwebutil.jar
    Oracle_Home\forms\webutil\sign_webutil Oracle_Home\forms\java\jacob.jar
    4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
    you may skip this step. Otherwise,
    Create a schema to hold the WebUtil stored code, and privileges needed to
    connect and create a stored package. Schema name "WEBUTIL" is recommended
    for no reason other than consistency over the user base.
    Open Oracle_Home\forms\create_webutil_db.sql in a text editor, and delete or comment
    out the EXIT statement, to be able to see whether the objects were created witout
    errors.
    Start SQL*Plus as SYSTEM, and issue:
    CREATE USER webutil IDENTIFIED BY [password]
    DEFAULT TABLESPACE users
    TEMPORARY TABLESPACE temp;
    GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
    CONNECT webutil/webutil@rcci
    @Oracle_Home\forms\create_webutil_db.sql
    -- Inspect SQL*Plus output for errors, and then
    CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
    Reconnect as SYSTEM, and issue:
    grant execute on webutil_db to public;
    5) Modify Oracle_Home\forms\server\default.env, and append Oracle_Home\jdk\jre\lib\rt.jar
    to the CLASSPATH entry.
    6) Modify Oracle_Home\forms\server\formsweb.cfg insde [default] add :
    archive_jini=frmall_jinit.jar,frmwebutil.jar,jacob.jar
    archive=frmall.jar
    also add :
    [webutil]
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    baseHTMLjinitiator=webutiljini.htm
    baseHTMLjpi=webutiljpi.htm
    baseHTML=webutilbase.htm
    archive_jini=frmall_jinit.jar
    WebUtilArchive=frmwebutil.jar,jacob.jar,f90all.jar
    archive=frmwebutil.jar,f90all.jar
    lookAndFeel=oracle
    7) Modify Oracle_Home\forms\server\webutil.cfg and add :
    transfer.database.enabled=TRUE
    transfer.appsrv.enabled=TRUE
    8) Start the OC4J instance
    9) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
    Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
    It is important to generate the PLX, to avoid the FRM-40039 discussed in Note 303682.1
    If the PLX is not generated, the Webutil.pll library would have to be attached with
    full path information to all forms wishing to use WebUtil. This is NOT recommended.
    10) Create a new FMB.
    Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
    There is no need to Subclass the WebutilConfig object.
    Attach the Webutil.pll Library, and remove the path.
    Add an ON-LOGON trigger with the code
    NULL;
    to avoid having to connect to an RDBMS (optional).
    Create a new button on a new canvas, with the code
    show_webutil_information (TRUE);
    in a WHEN-BUTTON-PRESSED trigger.
    Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
    11) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
    the "Application Server URL" is empty.
    Then append "?config=webutil" at the end, so you end up with a URL of the form
    http://server:port/forms/frmservlet?config=webutil
    12) Run your form.

  • In FTP server file not storing in proper order when 'FTP_R3_TO_SERVER'

    Dear ,
    when i used FTP_R3_TO_SERVER to download data in FTP server 
    i checked in FTP server  file is not storing in proper order in FTP server . plz help how to get the file in proper order .it urgent . full points must be given. i given code below .
    DATA : BEGIN OF iresult OCCURS 5,
    rec(450),
    END OF iresult ,
    DATA :
    dest LIKE rfcdes-rfcdest VALUE 'SAPFTP',
    compress TYPE c VALUE 'N',
    host(64) TYPE c.
    DATA: hdl TYPE i.
    DATA: BEGIN OF result OCCURS 0,
    line(100) TYPE c,
    END OF result.
    DATA : key TYPE i VALUE 26101957 ,
    dstlen TYPE i,
    blob_length TYPE i.
    host = p_host  .
    DESCRIBE FIELD p_password LENGTH dstlen IN CHARACTER MODE.
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
    ID 'SOURCE' FIELD p_password ID 'KEY' FIELD key
    ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD p_password
    ID 'DSTLEN' FIELD dstlen.
    CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
    user = p_user
    password = p_password
    host = host
    rfc_destination = dest
    IMPORTING
    handle = hdl
    EXCEPTIONS
    not_connected = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    CONCATENATE 'cd' ftppath INTO ftppath SEPARATED BY space .
    CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
    handle = hdl
    command = ftppath
    TABLES
    data = result
    EXCEPTIONS
    command_error = 1
    tcpip_error = 2.
    IF sy-subrc = 0 .
    CLEAR result .
    REFRESH result .
    CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
    handle = hdl
    command = 'ascii'
    TABLES
    data = result
    EXCEPTIONS
    command_error = 1
    tcpip_error = 2.
    IF sy-subrc = 0 .
    DESCRIBE TABLE iresult LINES lines.
    blob_length = lines * width .
    clear : lines.
    Delete the existing file
    CONCATENATE 'del' ftpfile INTO delfile SEPARATED BY SPACE.
    CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
    handle = hdl
    command = delfile
    TABLES
    data = result
    EXCEPTIONS
    command_error = 1
    tcpip_error = 2.
    *End of deleting the existing file
    CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
    handle = hdl
    fname = ftpfile
    blob_length = blob_length
    TABLES
    blob = iresult
    EXCEPTIONS
    TCPIP_ERROR = 1
    COMMAND_ERROR = 2
    DATA_ERROR = 3
    OTHERS = 4.
    IF sy-subrc 0 .
    WRITE 'Error in writing file to ftp' .
    ELSE.
    WRITE 'File downloaded on the ftp server successfully'.
    ENDIF.
    ENDIF.
    ELSE.
    WRITE : 'Path on ftp not found : ' , ftppath .
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
    EXPORTING
    handle = hdl.
    CALL FUNCTION 'RFC_CONNECTION_CLOSE'
    EXPORTING
    destination = 'SAPFTP'
    EXCEPTIONS
    OTHERS = 1.
    ELSE.
    WRITE 'Could not connect to ftp' .
    ENDIF.
    ENDFORM. " FTPFINANCEACCESS_DOWNLOAD
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF screen-name = 'PASSWORD'.
    screen-invisible = '1'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    Edited by: manoj kv on Feb 27, 2008 12:55 PM
    Edited by: manoj kv on Feb 28, 2008 5:37 AM
    Edited by: manoj kv on Feb 28, 2008 5:39 AM
    Edited by: manoj kv on Mar 5, 2008 2:15 PM
    Edited by: manoj kv on Mar 7, 2008 12:51 PM

    Hello,
    Did you try to put 'X' to the parameter CHARACTER_MODE.
    Hope it will help you
    Olivier

  • Script to open INDD files, run script, and close

    Hello, I'm looking for a script that will open a folder of Indesign files, open each one, run a selected script, then close each file.
    RIght now I'm using the Batch convert script, to convert INDD to INDD and run the script in between (then I delete the extra INDD file). But I'm trying to eliminate the conversion element, just need the script part of it.
    Anyone have any help? Thanks.

    Here's my whole code if it helps. I'm wondering if the script is moving too fast. I think that the first files are still PDFing while the others are opening and closing. Could that be it? I'm not sure why else the for loop for the PDFing is only working on the first file.
    var myFolder = Folder.selectDialog("Select Input Folder");
    var myIndsnFiles = myFolder.getFiles("*.indd");
    var exportPath=Folder("/").selectDlg("Select PDF output folder:");
    var pdfPreset = "Press Quality";
    for(k=0; k<myIndsnFiles.length; k++)
        app.open(myIndsnFiles[k]);
        var jobNumber = "12345";
            for (aPage=0; aPage < app.activeDocument.pages.length; aPage++)
                app.pdfExportPreferences.pageRange = app.activeDocument.pages[aPage].name;
                app.activeDocument.exportFile (ExportFormat.PDF_TYPE, File(exportPath+"/"+jobNumber+"_"+pad(app.activeDocument.pages[aPage].name)+".pdf"), false, pdfPreset);
                function pad (n) {
                return ("00000"+n).slice(-3);
    app.activeDocument.close();

  • How can I script a Flash .exe file to always stay on top of all other windows?

    Hi All,
    I'm new to action script, and I just need this one script
    > How can I script a Flash .exe file to always stay on top of
    all other windows?
    Basically what i want to do is have a flash-created
    step-by-step instructional movie, but for the movie to remain on
    top of all windows so the instructee is able to follow the
    instructions on-screen...
    It would be preferable to not have to buy another product
    just to do this... as I said, this is the only scripting I need.
    Thanks in advance
    Cheers
    Rick

    if you create your exe with mProjector you can use one of its
    new AS
    commands to do this.
    setZOrder
    http://www.screentime.com/software/mprojector/docs/mWin_setZOrder.htm
    all APIS
    http://www.screentime.com/software/mprojector/docs/index.html
    Demo
    http://www.screentime.com/software/mprojector/demo.html
    mProjector installs new classes and help into Flash, to
    enable them you
    must build your app with mProjector (its input is your swf)
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • How to load SQL scripts from a text file.

    Hi, i tried several time to load a text file/SQL script with 10 different tables and data, but 10g Express doesen't allows me to do that, any one can direct me or point out to me what i should do or do i need to adopt any special method to to get this done. i am sure there must be some thing where you can upload SQL scripts from a text file (in SQL command editor!). thanks

    Hi,
    see my other answer here:
    SQL command editor doesn't take more than 1 insert command
    This seems to be a duplicate question, right? Or am I missing something?
    Regards,
    ~Dietmar.

  • A script for copying smilar files to a new location

    Hi,
    i newbies to scripting. My challenge is that I want a script to only copy files with names "similar" and not "exactly the same" as the filenames in the text file.
    For example some files have 10 letters file name like "ABC01FGH01.tif".  I have to copy file where starting letter "ABC" and middle letter "FGH" of file name are fixed, but other letters are changed.
    The script sees a file name like "ABC**FGH**.tif", it should search the source location and copy the files having filenames with at least this characters e.g. "ABC02FGH02.tif", "ABC03FGH04.tif" should be copied since it has
    contains "ABC**FGH**.tif".
    Please help.

    Learn how to use wildcards in file names.  '*' is for any number of characters and'?' is for one character.
    COPY ABC??DE???.?x? c:\target
    Start by using DIR
    DIR ABC??DEF???JK.?x?
    ¯\_(ツ)_/¯

  • Is CPA Cache refresh linked with  ftp or file pooling process in XI?

    Hi,
    I have a file to file scenario using Transport protocol as FTP in XI 3.0 SP 15.
    When we try to sends some file using ftp protocol where we are using
    FTP  connection parameters
    Server                          = <CORRECT IP>,
    Port                               =  21 ,
    User name                <CORRECT NAME>,
    Password                  <PASSWORD> ,
    Data Connection           = Active
    Connection Seq          = None
    Connection Mode          = Permanently
    Transfer Mode            =   Text
    Processing Parameters
    Quality of Service    = Exactly Once
    Pooling Interval        = 1 sec
    Processing Mode    = delete
    File Type                   = Text
    File encoding           = utf-8                 
    The problem we are facing like some time the ftp is not working even the file is present in the location for pick up. If few files are stacked up to be collected then when we are using CPA Cache refresh in Full mode manually then it fetches all the files from the location but the problem is that ,we have a time constraint for this process to be completed in just 60 seconds if we are not able to pick up a  file in 60 Secs then the file will be treated as invalid.
    So I just want to know how Manual CPA CACHE refresh in full mode generally solve the problem.
    Next if more files will be stacked up then cache refresh also failed to solve the problem and more cache refresh result in NOT pooling any other files in XI including the above discussed flow.
    So,in anyway Cache refresh linked with ftp or file pooling process in XI?
    Please assist me in correctly understating the whole problem and what solution could be put to solve this.
    Thanks,
    Satya
    Edited by: Satya Jethy on Mar 14, 2008 12:28 PM

    Hi Suraj,
      If you see my query i have mentioned that the pooling interval is 1 Second.
    If we are not able to pick the file with in 60 Secs as this is a  real time scenario so the file will be treated as a invalid file.
    Moreover this problem is happening some time.
    I have also checked the component monitoring it is saying everything is ok as because we are receiving the file with out any error and the file transfer is also success.The only problem is that it is not collecting the files from the given location.
    Hope i make you understnad the problem .If not please revert back i will try to explain once again.
    Thanks,
    Satya

Maybe you are looking for

  • Reading file using File Adapter in BPEL

    Hi, I am using JDeveloper 11g. I am trying to Read XML file and write content to Text file. I created XML Schema, XML file. I created Asynchronous BPEL process (Auto Generated) I took one File adapter which will have Read operation and one more File

  • Rank Question

    Hello, Why does this SQL not work in a PL/SQL function in my report? rank() over (ORDER BY column_name DESC) AS column_name I am wanting a report that looks something like this... Name     01/2002     Rank     02/2002     Rank     03/2002     Rank   

  • Trouble quitting applications in Lion

    iTunes, iPhoto, and now Fire Fox don't seem to want to quit. iTunes and iPhoto will quit (after several minutes) and if I try to force quit either, they are not reported as "not responding". Fire Fox may be an abberation because when it would not res

  • I am trying to burn a long DVD through iDVD.

    The project is in iMovie and is 2hrs 11m long. iDVD requests I cut the project but I can't cut anymore out. I have previously burnt a DVD at 2hrs 4m and this was fine. I am using OSX 10.8.3. I do not have a DVD player that is compatible for Dual Laye

  • Moving documents with a workflow from a document library to a folder and back to the document library

    Hello all, I have created a document library with a folder inside of it. By means of a workflow, I could move a document that was in the document library to the folder using the action "update path and name". Now I need to do the reverse path, that i