forked from adrianyorke/robotframework-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recipe041_working_with_file_system.robot
26 lines (24 loc) · 1.12 KB
/
recipe041_working_with_file_system.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
*** Settings ***
Documentation PROBLEM:
... You want to query the file system and list items, files and directories.
... DISCUSSION:
... This recipe demonstrates list variables, FOR loop and how to import a library.
... We choose ${TEMPDIR} here as it works on all platforms.
Library OperatingSystem
Force Tags py3.7 py3.8 py3.9
*** Variables ***
${recipe} Recipe 4.1 Working With File System
${level} Beginner
${category} Internal Library: OperatingSystem
*** Test Cases ***
Listing Directory Contents
Log Variables
@{itemlist} = List Directory ${TEMPDIR}
@{filelist} = List Files In Directory ${TEMPDIR} absolute=True
@{directorylist} = List Directories In Directory ${TEMPDIR}
${countitems} = Count Items In Directory ${TEMPDIR}
${countfiles} = Count Files In Directory ${TEMPDIR}
${countdirectories} = Count Directories In Directory ${TEMPDIR}
FOR ${directory} IN @{directorylist}
Log ${directory} console=true
END