LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Changing File Types

    Employee
    Posted 06-16-2015 06:13

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: jchartrand

    One of our applications writes file to a directory and will change the file type to identify the action taken on the file.

    In one directory files are identified as an error by the system saving the file as .BAD. If I change the filename to .txt it becomes something that I can then open and review.

    Is there a way that I can do this action in lavastorm for all the files with this extension on the end?

    Example:
    2015_05_GFC01_STD_15.BAD


  • 2.  RE: Changing File Types

    Employee
    Posted 06-16-2015 08:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    I think you want to use the Brainscript Operator moveFile(from,to)

    moveFile allows you to either move and/or rename files

    so:

    moveFile("2015_05_GFC01_STD_15.BAD","2015_05_GFC01 _STD_15.txt")

    would accomplish what you want.


  • 3.  RE: Changing File Types

    Employee
    Posted 06-16-2015 10:04

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: jchartrand

    Hi Stoney,

    Appears that I should provide ALL the details when submitting something to the forum.

    I came accross an error saying that there was an invalid escape sequence in thread due to the directory pulling in "\". I found on the forums that these required an additional "\" in order to work.

    If I needed to perform the movefile accross the entire directory would I first need to perform a replace function on the "\" and then use movefile on all .BAD to .txt?

    FileName
    C:\Users\josh.chartrand\Desktop\Error Test - Copy/2015_03_SYC02_STD_10.BAD
    C:\Users\josh.chartrand\Desktop\Error Test - Copy/2015_03_SYC02_STD_11.BAD
    C:\Users\josh.chartrand\Desktop\Error Test - Copy/2015_03_SYC02_STD_12.BAD
    C:\Users\josh.chartrand\Desktop\Error Test - Copy/2015_03_SYC02_STD_13.BAD


  • 4.  RE: Changing File Types

    Employee
    Posted 06-16-2015 12:15

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Actually, if you change all the "\" to "/" it will work.. even in Windows.

    In a filter, you could do this:

    emit *
    override emit FileName=FileName.replace("\\","/")