Example #1
0
# mounting over an existing mount point
try:
    uos.mount(Filesystem(3), '/test_mnt2')
except OSError:
    print('OSError')

# mkdir of a mount point
try:
    uos.mkdir('/test_mnt')
except OSError:
    print('OSError')

# rename across a filesystem
try:
    uos.rename('/test_mnt/a', '/test_mnt2/b')
except OSError:
    print('OSError')

# delegating to mounted filesystem
uos.chdir('test_mnt')
print(uos.listdir())
print(uos.getcwd())
uos.mkdir('test_dir')
uos.remove('test_file')
uos.rename('test_file', 'test_file2')
uos.rmdir('test_dir')
print(uos.stat('test_file'))
print(uos.statvfs('/test_mnt'))
open('test_file')
open('test_file', 'wb')
Example #2
0
# mounting over an existing mount point
try:
    uos.mount(Filesystem(3), '/test_mnt2')
except OSError:
    print('OSError')

# mkdir of a mount point
try:
    uos.mkdir('/test_mnt')
except OSError:
    print('OSError')

# rename across a filesystem
try:
    uos.rename('/test_mnt/a', '/test_mnt2/b')
except OSError:
    print('OSError')

# delegating to mounted filesystem
uos.chdir('test_mnt')
print(uos.listdir())
print(uos.getcwd())
uos.mkdir('test_dir')
uos.remove('test_file')
uos.rename('test_file', 'test_file2')
uos.rmdir('test_dir')
print(uos.stat('test_file'))
print(uos.statvfs('/test_mnt'))
open('test_file')
open('test_file', 'wb')
Example #3
0
f = open('test.txt', 'w')
f.write('hello')
f.close()

print(uos.listdir())
print(uos.listdir('/'))
print(uos.stat('')[:-3])
print(uos.stat('/')[:-3])
print(uos.stat('test.txt')[:-3])
print(uos.stat('/test.txt')[:-3])

f = open('/test.txt')
print(f.read())
f.close()

uos.rename('test.txt', 'test2.txt')
print(uos.listdir())
uos.rename('test2.txt', '/test3.txt')
print(uos.listdir())
uos.rename('/test3.txt', 'test4.txt')
print(uos.listdir())
uos.rename('/test4.txt', '/test5.txt')
print(uos.listdir())

uos.mkdir('dir')
print(uos.listdir())
uos.mkdir('/dir2')
print(uos.listdir())
uos.mkdir('dir/subdir')
print(uos.listdir('dir'))
for exist in ('', '/', 'dir', '/dir', 'dir/subdir'):
Example #4
0
f = open('test.txt', 'w')
f.write('hello')
f.close()

print(uos.listdir())
print(uos.listdir('/'))
print(uos.stat('')[:-3])
print(uos.stat('/')[:-3])
print(uos.stat('test.txt')[:-3])
print(uos.stat('/test.txt')[:-3])

f = open('/test.txt')
print(f.read())
f.close()

uos.rename('test.txt', 'test2.txt')
print(uos.listdir())
uos.rename('test2.txt', '/test3.txt')
print(uos.listdir())
uos.rename('/test3.txt', 'test4.txt')
print(uos.listdir())
uos.rename('/test4.txt', '/test5.txt')
print(uos.listdir())

uos.mkdir('dir')
print(uos.listdir())
uos.mkdir('/dir2')
print(uos.listdir())
uos.mkdir('dir/subdir')
print(uos.listdir('dir'))
for exist in ('', '/', 'dir', '/dir', 'dir/subdir'):