how to run a single macro on all files in a folder? in mac terminal, please give full details, I'm a complete beginner

I want to run a single macro on all files in a folder in mac terminal that is listed in /Desktop/NewFolder. Please provide full details as I am complete beginner, I tried this

for f in $(ls /Users/l214/Desktop/NewFolder/*.csv);
do macro:///Standard.Module1.Macro1 $f;
done

it gave me -
-bash: macro:///Standard.Module1.Macro1: No such file or directory

The location and names of macros and files are correct
But it didn’t work, should I open the terminal in the location of Libreoffice or paste the folder in Libreoffice ? or some other function first? please give full details and a code example
Thank you.

  1. Invalid Bash Command

macro:///Standard.Module1.Macro1 isn’t a valid bash command. Try to call in a terminal witthout the for ...; do ...;done loop. So your command must fail.

  1. Macro

If you want to call a LibreOffice macro from the command line, you need to start LibreOffice in CLI mode, Open a file and run the macro, which is part of the file - If, at all, a loop would need to read something like:

for f in $(ls /Users/l214/Desktop/NewFolder/*.csv); do /Applications/LibreOffice.app/Contents/MacOS/soffice --headless $f macro:///Standard.Module1.Macro1; done

But: This also will not work, since .csv files do not contain macros, which could be called. As per /Applications/LibreOffice.app/Contents/MacOS/soffice --help:

Using without special arguments:                                               
...
   {file} {macro:///Library.Module.MacroName} 
   Opens the file and runs specified macros from the file

…Continued… Please describe what you want to achieve since your current approach is completely wrong and based on the information it is impossible to provide a code example (correct example) without knowing what you intend your macro to perform on the csv files. May be it would be good idea to share the macro code to get a clue of your intention.

@anon73440385 thank you so much for explaining, I have understood now.