Get file path
List the files in a folder, by full path, into a variable you can loop over.
In both apps
WarpX Browser
WarpX Phone
Use this block when a run has to work through files: upload every image in a folder, read each CSV a tool exported, or zip whatever a run downloaded. It gives a list of full paths sorted by name, which Loop data can walk through one at a time. It works only in the WarpX Browser desktop app.
Settings
- Folder
The whole path of the folder. A leading
~means your home folder. The folder button opens a folder dialog. A folder that does not exist stops the block with an error.ExampleC:\Users\me\Pictures\avatars- Include files in subfolders
Off, only the files directly in the folder. On, the files in every folder under it as well. Folders themselves are never listed.
ExampleUnchecked- File extensions
Only files ending with one of these, separated by commas. The dot is optional and case does not matter, so
jpgalso findsPHOTO.JPG. Empty lists every file.Example.jpg, .png- Assign to variable
Keeps the list in a variable. It is ticked when you add the block.
ExampleChecked- Variable namewhen Assign to variable is ticked
The variable for the list. The default is
files. Read it later as{{variables.avatars}}.Exampleavatars- Insert to table
Writes each path into a table column as well.
ExampleUnchecked- Select columnwhen Insert to table is ticked
The column to write to.
Examplefile
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
Hands on the list of paths, such as ["C:\Users\me\Pictures\avatars\01.jpg", "C:\Users\me\Pictures\avatars\02.jpg"], which the next block reads as {{prevBlockData}}. The log line says how many files it found. Leaves by its single output.
Example: Upload a different avatar to each account
- Start
- Get file path
- Loop data
- New tab
- Upload file
- Put the images in
C:\Users\me\Pictures\avatars. - Add Get file path and set Folder to that folder.
- Set File extensions to
.jpg, .pngand leave Include files in subfolders off. - Keep Assign to variable ticked and name it
avatars. - Add Loop data, set Loop through to Variable, Variable name to
avatarsand Loop ID toavatar. - Inside the loop, open the profile page and use Upload file with
{{loopData.avatar}}in URL/File path/base64.
Good to know
- Desktop app only. In the browser extension the block is not in the list.
- Files are sorted by name the way people count, so
2.jpgcomes before10.jpg. With subfolders on, each folder's files come where the folder sorts. - At most 10,000 files. Past that, the list stops and the log line says
(stopped at 10,000). - A subfolder the app may not read is skipped rather than stopping the block.
- The list holds full paths, ready for Upload file, Zip or File action's Delete.
See also
- Loop data — Run the blocks after it once for each row, number, list item or element.
- Upload file — Put one or more files into a file input on the page, from your computer, a URL or inline data.
- Zip — Compress files and folders into a zip file, or extract a zip into a folder.
- Read TXT — Take lines, or pieces between a delimiter, from a TXT file into a variable, optionally deleting them from the file.