1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

problems with file move script

Discussion in 'T&T - Scripting' started by rawood11, Oct 28, 2008.

  1. rawood11

    Joined:
    Oct 2, 2008
    Messages:
    19
    Likes Received:
    0
    I have problems as noted in this script:


    rem ---- loop through directories under j:\taqDAILYNBBO\ ----

    rem --------------- enter a blank line ---------
    echo ' '
    rem ---------------- how do i enter a blank line?

    for /r /D j:\taqDAILYNBBO\ %x in (*) (
    echo file in J:= %x
    echo %@filesize[%x]
    iff %@filesize[%x]>5000000000 then

    rem ------ both of the statement below give errors -----
    rem if (%@filesize["%x\_A"]>100 .AND. %@filesize["%x\_ZZ"]>100) (
    rem iff (%@filesize["%x\_A"]>100 .AND. %@filesize["%x\_ZZ"]>100) then


    echo filesize for _ZZ in J:= %@filesize["%x\_ZZ"]
    iff %@filesize["%x\_ZZ"]>100 then
    echo data exists in J:

    echo does directory exist in M:? %@filesize["m:\taqDAILYNBBO\%@substr[%x,16]"]
    iff %@filesize["m:\taqDAILYNBBO\%@substr[%x,16]"] == -1 then
    rem -- this is not working. what is the indication the the directory does not exist?
    rem mkdir "m:\taqDAILYNBBO\%@substr[%x,16]"
    endiff

    rem ------- trying to list the files in %x, why does this not work? -------
    for %x %y in (*) (
    echo ticker= %y
    )

    echo file size in M:= %@filesize["m:\taqDAILYNBBO\%@substr[%x,16]\_a"]

    iff %@filesize["m:\taqDAILYNBBO\%@substr[%x,16]\_a"] == -1 then
    rem
    echo enter file move command here
    endiff
    endiff
    endiff
    )

    SOME OF THE OUTPUT FOLLOWS:

    file in J:= J:\taqDAILYNBBO\20070712
    0
    file in J:= J:\taqDAILYNBBO\20070713
    7350478392
    filesize for _ZZ in J:= 554030
    data exists in J:
    does directory exist in M:? 0
    C:\Program Files (x86)\JPSoft\TCMD9\mine\sz.btm [41] Usage : FOR [/A:[[-][+]rhsdaecjot] /D /F ["options"] /H /I"text" /L /R [path] /T"..."] %var IN ([@]set | start, ste
    p, end) [DO] command ...
    file size in M:= -1
    enter file move command here

     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,351
    Likes Received:
    39
    I strongly suggest that you post support requests in Take Command / Support. In Tips&Tricks, people may not find them....

    You can use ECHO. , just like in COMMAND.COM / CMD.EXE. Your idea works too; just use backquotes instead of apostrophes: ECHO ` `

    I'm not going to spend much time deciphering your script, but I do notice:

    Remember that < and > are redirection operators. Comparison operators are GT (greater than), LT (less than), GE (greater than or equal), LE (less than or equal), and so on. Type HELP CONDITIONALEXPRESSIONS for more info.
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    JP Software Forums" <neil@jpsoft.com>; "rawood11 wrote:
    | I have problems as noted in this script:
    |
    |
    | rem ---- loop through directories under j:\taqDAILYNBBO\ ----
    |
    | rem --------------- enter a blank line ---------
    | echo ' '
    | rem ---------------- how do i enter a blank line?

    Do you mean "enter a blank line into my batch file"? If so, that depends on
    your editor. If you mean "How do I display a blank line", the simplest
    command is

    echo.

    Note there is no space between the command name ECHO and the period. This is
    a special technique that has been around at least since PC-DOS 3.3 in
    COMMAND.COM
    |
    | for /r /D j:\taqDAILYNBBO\ %x in (*) (
    | echo file in J:= %x
    | echo %@filesize[%x]
    | iff %@filesize[%x]>5000000000 then
    |
    | rem ------ both of the statement below give errors -----
    | rem if (%@filesize["%x\_A"]>100 .AND. %@filesize["%x\_ZZ"]>100) (
    | rem iff (%@filesize["%x\_A"]>100 .AND. %@filesize["%x\_ZZ"]>100)

    The "less than" < and "greater than" > characters are special characters
    used exclusively for redirection. You must use one of the operators GE GT LE
    LT for comparisons. See help Topic "conditionalexpressions.htm"

    I did not analyze the rest of your program. Please make the appropriate
    corrections, and if still having problems, post just the problem part.
    --
    HTH, Steve
     

Share This Page