Hi,
wanted to list the files in a directory and copy the only file name into property file,
using by win_shell:
-
name:list the files
win_shell: ‘ls {{directory}} > {{directory}}/manifest.prob’
register: dir_out -
debug: var={{item}}
with_items: dir_out.stdout_lines
out put as
Mode LastWriteTime Length Name
-a---- 9/9/2019 9:05 AM 7289 Database_0.0.100.zip
-a---- 9/9/2019 9:03 AM 18447 EMC_ECS-package_0.0.100.zip
-a---- 9/17/2019 1:02 PM 0 file.txt
-a---- 9/9/2019 9:05 AM 7434 hotfix-DDMInfra.zip
-a---- 9/9/2019 9:03 AM 15631 hotfix-IIS.zip
-a---- 9/9/2019 9:05 AM 16808 hotfix-QCIM1H126382-v3.zip
I don’t want other information, How list only file names?