Answer the question
In order to leave comments, you need to log in
Display in one specific folder the names of folders with name length =2?
help you need: for zabix, output so that he reads and understands
Display in one specific folder the names of folders with name length = 2
you need to display like this:
{
"data":[
{
"{#LOGNAME}":"og"
},
{
" {#LOGNAME}":"og"
},
{
"{#LOGNAME}":"og"
}
]
}
but instead of og my folders
Answer the question
In order to leave comments, you need to log in
well, by tradition, the solution is in powershell :D
[email protected]{"data"=""}
$data.data=(get-childitem c:\test -directory | where {$_.name.Length -eq 2} | Select @{name='{#LOGNAME}';expression={$_.name}}
$data | convertto-json | out-file c:\test\json.json
The topic can be closed thanks to everyone, if anything, here is my script:
@echo off&::
Setlocal EnableDelayedExpansion
Set B=
echo {
echo "data":[
echo {
Set /a C=0
For /F %%A in ('dir /b E:\testt\??') do (
set B=%%A
if not "!C!"=="0" (
echo },
echo {
)
set /a C=!C!+1
echo "{# LOGNAME}":"!B!"
)
echo }
echo ]
echo }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question