Automic Workload Automation

Expand all | Collapse all

Directory listing of file today-1

Jump to Best Answer
  • 1.  Directory listing of file today-1

    Posted 14 days ago
    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 14 days ago
    Edited by Douglas MacLacklin 14 days ago
    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 14 days ago
    Edited by Pete Wirfs 14 days ago
    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 14 days ago
    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 14 days ago
    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 14 days ago
    Thanks. I'll take a look at the doc.

    Doug


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

    Posted 13 days ago
    Edited by Carsten Schmitz 13 days ago
    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 13 days ago
    Yes, it's Windows, but thanks for the reply.

    Doug


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

    Posted 7 days ago
    Hello,

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

    Greetings
    Markus