Os.system method unavailable in anvil server

What I’m trying to do:
Hello all
I’m just starting to learn ANVIL, and I’m trying to rebuild my old system with ANVIL.
I got to a point where I couldn’t apply it, which is to use CMD commands from the OS library
for example:
import os
cmd = ‘ls-al’
os. system(cmd)
I tried to implement it on the server, but I couldn’t, is there any suggestion for help.

os.listdir() is typically preferable to calling ls. You can do this in a server module:

import os

@anvil.server.callable
def get_files():
  return os.listdir()

and call that function from client code:

print(anvil.server.call('get_files'))

But do you need to read the files in your Anvil account? Is what you’re trying to accomplish perhaps better achieved by storing files in a data table?

thanks, I just test your solution, it works for this functio
(list direcory files)
Best regards