Only available on OMEGA & it’’s forks. Omega is an alternative os that offer a bunch of cool features, including an “os module” in python that this script is using. You can download it here. Support on their discord.
from math import * from os import * def __list_files(): files=sorted(listdir()) fs=[] for i,fn in enumerate(files): fs+=["%i b"%(len(open(fn).read()))] __printTab( ["Id",""]+[str(n) for n in range(len(files))], ["File",""]+files, ["Size",""]+fs) def __fill_str(s,l,c=" "): return s+c*(l-len(s)) def __printTab(*tab): max_size=[] for line in tab: mx=0 for e in line: l=len(str(e)) if l>mx:mx=l max_size+=[mx+3] for i in range(len(tab[0])): print("|",end="") for j,l in enumerate(tab): try:print(__fill_str(l[i],max_size[j]),end="|") except:print(" "*max_size[j],end="|") print() def __rename_file(id): fn=sorted(listdir())[id] try: nn=input("Enter new name for %s:\n"%(fn)) rename(fn,nn) print("File %s renamed in %s"%(fn,nn)) except: print("Input error, failed") return def __del_file(id): fn=sorted(listdir())[id] try: confirm=input( "Are you sure you want to delete %s ? Type the filename to confirm :\n") if confirm==fn: remove(fn) print("File %s deleted"%(fn)) else:print("Aborted.") except: print("Input error, failed") def __doc(): print(""" Simple files manager inspired by the unix shell. Require the file support and the OS module = working on Omega and his forks.""") __printTab( ["Command","","ls","doc","exit","rm <file id>","rn <file_id>"], ["Desc","","list files","show this msg","exit","remove the file","rename the file"]) ls=__list_files rm=__del_file rn=__rename_file doc=__doc exit=lambda :print("Exiting...") __inp=[""] print("Simple FM, type exit to quit\nand press toolbox to see commands\n") while __inp[0]!="exit": try: __inp=input("\t$ ").split(" ") argstr="" for arg in __inp[1:]:argstr+=arg+"," eval(__inp[0]+"(%s)"%(argstr)) except: print("Incorrect syntax...") continue