Combine 2 output files into 1? Append to the end

(imported topic written by JamesN91)

####################################################

// get the list of the files and their paths NOT HIDDEN

parameter “outputfile1” = "{pathname of parent folder of regapp “besclient.exe”}{“Media_” & current year as string & current month as two digits & current day_of_month as two digits & "

" & name of logged on user as string & "

" & computer name as string & “.csv”}"

waithidden {pathname of system folder}\cmd.exe /C dir /s /b c:.mp3, c:.mp4, c:.avi, c:.wmv, c:.mpg, c:.mpeg, c:.rm, c:.flac, c:.3gp, c:.3gpp, c:.asf, c:.divx, c:*.qt | findstr /i /v “Roxio” | findstr /i /v “program” | findstr /i /v “windowsmediaplayer” | findstr /i /v “system32” | findstr /i /v “clock.avi”>"{parameter “outputfile1”}"

// go through the list in relevance to remove docs and settings and look up size/dates

appendfile {concatenation “%0d%0a” of (if (exists (file (it))) then (it & ", " & (((month of it as two digits & “/” & day_of_month of it as two digits & “/” & year of it as string) of date(local time zone) of it & " "& (two digit hour of it as string & “:” & two digit minute of it as string & “:” & two digit second of it as string) of time (local time zone) of it) of modification time of file(it)) as string & ", " & (size of file(it) as string) & ", " & (if (it contains “.”) then “.” & following text of last “.” of it else “n/a”)) else nothings) of lines whose (it as lowercase does not contain “documents and settings” AND it as lowercase does not contain “__besdata”) of file (parameter “outputfile1”)}

// replace the output file with the new file

delete “{parameter “outputfile1”}”

move __appendfile “{parameter “outputfile1”}”

// get the list of the files and their paths HIDDEN NOTE has same .csv name as outputfile 1

parameter “outputfile2” = "{pathname of parent folder of regapp “besclient.exe”}{“Media_” & current year as string & current month as two digits & current day_of_month as two digits & "

" & name of logged on user as string & "

" & computer name as string & “.csv”}"

waithidden {pathname of system folder}\cmd.exe /C dir /AH /s /b c:.mp3, c:.mp4, c:.avi, c:.wmv, c:.mpg, c:.mpeg, c:.rm, c:.flac, c:.3gp, c:.3gpp, c:.asf, c:.divx, c:*.qt | findstr /i /v “Roxio” | findstr /i /v “program” | findstr /i /v “windowsmediaplayer” | findstr /i /v “system32” | findstr /i /v “clock.avi”>"{parameter “outputfile2”}"

// go through the list in relevance to remove docs and settings and look up size/dates

appendfile {concatenation “%0d%0a” of (if (exists (file (it))) then (it & ", " & (((month of it as two digits & “/” & day_of_month of it as two digits & “/” & year of it as string) of date(local time zone) of it & " "& (two digit hour of it as string & “:” & two digit minute of it as string & “:” & two digit second of it as string) of time (local time zone) of it) of modification time of file(it)) as string & ", " & (size of file(it) as string) & ", " & (if (it contains “.”) then “.” & following text of last “.” of it else “n/a”)) else nothings) of lines whose (it as lowercase does not contain “documents and settings” AND it as lowercase does not contain “__besdata”) of file (parameter “outputfile2”)}

// replace the output file with the new file

delete “{parameter “outputfile2”}”

move __appendfile “{parameter “outputfile2”}”

##############################################

Here is my situation. I need to find all of the above file extension types that are hidden and not hidden and place them in a single .csv file that will be analyised by BF web reports.

Basically this…

Outputfile1 + Outputfile2 = Outputfile3 = {“Media_” & current year as string & current month as two digits & current day_of_month as two digits & "

" & name of logged on user as string & "

" & computer name as string & “.csv”}

Advice?

(imported comment written by BenKus)

Well… your outfiles are currently named the same thing…

I think you can simply append the two searches to the same file and then filter them…

// get the list of the files and their paths NOT HIDDEN

parameter “outputfile1” = “{pathname of parent folder of regapp “besclient.exe”}{“Media_” & current year as string & current month as two digits & current day_of_month as two digits & “” & name of logged on user as string & “” & computer name as string & “.csv”}“
waithidden {pathname of system folder}\cmd.exe /C dir /s /b c:.mp3, c:.mp4, c:.avi, c:.wmv, c:.mpg, c:.mpeg, c:.rm, c:.flac, c:.3gp, c:.3gpp, c:.asf, c:.divx, c:*.qt | findstr /i /v “Roxio” | findstr /i /v “program” | findstr /i /v “windowsmediaplayer” | findstr /i /v “system32” | findstr /i /v “clock.avi”>”{parameter “outputfile1”}”

// get the list of the files and their paths HIDDEN NOTE has same .csv name as outputfile 1

waithidden {pathname of system folder}\cmd.exe /C dir /AH /s /b c:.mp3, c:.mp4, c:.avi, c:.wmv, c:.mpg, c:.mpeg, c:.rm, c:.flac, c:.3gp, c:.3gpp, c:.asf, c:.divx, c:*.qt | findstr /i /v “Roxio” | findstr /i /v “program” | findstr /i /v “windowsmediaplayer” | findstr /i /v “system32” | findstr /i /v “clock.avi” >>"{parameter “outputfile1”}"

// go through the list in relevance to remove docs and settings and look up size/dates

appendfile {concatenation “%0d%0a” of (if (exists (file (it))) then (it & ", " & (((month of it as two digits & “/” & day_of_month of it as two digits & “/” & year of it as string) of date(local time zone) of it & " "& (two digit hour of it as string & “:” & two digit minute of it as string & “:” & two digit second of it as string) of time (local time zone) of it) of modification time of file(it)) as string & ", " & (size of file(it) as string) & ", " & (if (it contains “.”) then “.” & following text of last “.” of it else “n/a”)) else nothings) of lines whose (it as lowercase does not contain “documents and settings” AND it as lowercase does not contain “__besdata”) of file (parameter “outputfile1”)}

// replace the output file with the new file

delete "{parameter “outputfile1”}"
move __appendfile “{parameter “outputfile1”}”

See if that works…

Ben

(imported comment written by JamesN91)

So this

…“clock.avi”>"{parameter “outputfile1”}"

VS

clock.avi" >>"{parameter “outputfile1”}"

The “>>” will append to Outputfile1? I was worried it would overwrite. I will give it a try and see what I get.

(imported comment written by NoahSalzman)

Yes, double angle-brackets append. The MS reference page is

here

.

Writes the command output to a file or a device, such as a printer, instead of the Command Prompt window.

Appends the command output to the end of a file without deleting the information that is already in the file.

(imported comment written by JamesN91)

Never knew that simple little command. Thanks!

FYI - That worked like a champ. The results are exactly what I need. Thankyou.

(imported comment written by SystemAdmin)

Hi,

I need to replace a file on all of the client PC’s using bigfix. I am using bigfix 7.2 version. Anyone can help me in writing a custom fixlet

(imported comment written by BenKus)

Hi vijayanand,

You probably should start a new thread on this. Also, you will need to give more details about what you are looking to do so we can assist.

Thanks,

Ben