Automic Workload Automation

 View Only
  • 1.  Directory listing of file today-1

    Posted Feb 10, 2020 11:57 AM
    Hello,

    I'm trying to print a directory listing of all file from the previous day.

    I'm hung up with the date-1 part.

    Appreciate some help.

    Thanks,
    Doug


  • 2.  RE: Directory listing of file today-1

    Posted Feb 10, 2020 02:36 PM
    Edited by DouglasMacLacklin608959 Feb 10, 2020 02:38 PM
    Since the date is in different format depending on vendor, I need to use the modified date. The bepow script works fine, but not exactly the result I need.

    :SET &TODAY# = SYS_DATE("MMDDYYYY")
    :SET &PREVDATE# = SUB_DAYS("MMDDYYYY:&TODAY#",1)
    :SET &HND# = PREP_PROCESS_FILENAME("Host","D:\ARCHIVE\OUTGOING\HHH\*.*","Y",,,,"UC_LOGIN=LOGIN.NNN")
    :PROCESS &HND#
    : SET &LINE# = GET_PROCESS_LINE(&HND#,&PREVDATE#)
    !: PRINT &LINE#
    :ENDPROCESS
    DIR D:\ARCHIVE\OUTGOING\BEACON\*&PREVDATE#*.*

    Thanks,
    Doug


    ------------------------------



  • 3.  RE: Directory listing of file today-1

    Posted Feb 10, 2020 02:44 PM
    Edited by Pete Wirfs Feb 10, 2020 02:59 PM
    You are pulling a list of file names from one directory, and then running the DIR command against a different directory.  Was this your intention?

    ------------------------------
    Pete
    ------------------------------



  • 4.  RE: Directory listing of file today-1

    Posted Feb 10, 2020 03:28 PM
    This was a typo, the directory names are the same, ultimately I will pull from \OUTGOING. Trying to pull the list from the modified date since the date format is different depending on the vendor.


  • 5.  RE: Directory listing of file today-1

    Posted Feb 10, 2020 04:12 PM
    I think you may be mis-using the GET_PROCESS_LINE() function.   It doesn't make sense to me that you are passing it &PREVDATE# 

    https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/12.3/Automic%20Automation%20Guides/help.htm#Script/Reference/GET_PROCESS_LINE.htm%3FTocPath%3DReference%7CAutomation%2520Engine%2520Script%2520Reference%7CScript%2520Elements%2520Ordered%2520by%2520Purpose%7CData%2520Sequences%7C_____5

    ------------------------------
    Pete
    ------------------------------



  • 6.  RE: Directory listing of file today-1

    Posted Feb 10, 2020 04:16 PM
    Thanks. I'll take a look at the doc.

    Doug


  • 7.  RE: Directory listing of file today-1
    Best Answer

    Posted Feb 11, 2020 07:53 AM
    Edited by Diane Craddock Feb 11, 2020 10:54 AM
    Depending on what platform that is, you could also do this natively and not bother much with Automic Script at all.

    ls -1 > /somedir/$(date +"%Y-%m-%d")

    and then on the day after:

    cat /somedir/$(date +"%Y-%m-%d" -d yesterday)

    Hth,


    (edit: nevermind, I see now by your path names that it's Windows ... but possibly powershell can do something just like that)


    ------------------------------
    These contain very good advise on asking questions and describing supposed bugs (no, you do not need to go to StackExchange for Automic questions, but yes, the parts on asking detailed, useful questions ARE usually relevant):

    http://www.catb.org/~esr/faqs/smart-questions.html

    https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

    I will not respond to PM asking for help unless there's an actual reason to keep the discussion off of the public forums.
    ------------------------------



  • 8.  RE: Directory listing of file today-1

    Posted Feb 11, 2020 08:24 AM
    Yes, it's Windows, but thanks for the reply.

    Doug


  • 9.  RE: Directory listing of file today-1

    Posted Feb 17, 2020 08:35 AM
    Hello,

    if the problem still exists, look at the command :
    forfiles  /D -1 .........

    Greetings
    Markus