Esempio n. 1
0
import argparse
from os.path import abspath
from pykern.filesystem import FileSystem

parser = argparse.ArgumentParser()
parser.add_argument('source')
parser.add_argument('dest')

args = parser.parse_args()
fs = FileSystem()

src = fs.get_superblock(args.source)

try:
    dest = fs.get_superblock(args.dest)
except OSError:
    pass
fs.superblocks[abspath(args.dest)] = src.copy()
del fs.superblocks[abspath(args.source)]
fs.save_superblocks()
Esempio n. 2
0
def stat(p):
    fs = FileSystem()
    p = path.abspath(p)
    superblock = fs.get_superblock(p)
    return stat_result(superblock['mode'], superblock['size'])
Esempio n. 3
0
def stat(p):
    fs = FileSystem()
    p = path.abspath(p)
    superblock = fs.get_superblock(p)
    return stat_result(superblock['mode'], superblock['size'])
Esempio n. 4
0
def chdir(p):
    fs = FileSystem()
    absolute_path = path.abspath('%s' % p)
    fs.get_superblock(absolute_path, mode=fs.DIRECTORY_MODE)
    fs.current_directory = absolute_path
Esempio n. 5
0
def chdir(p):
    fs = FileSystem()
    absolute_path = path.abspath('%s' % p)
    fs.get_superblock(absolute_path, mode=fs.DIRECTORY_MODE)
    fs.current_directory = absolute_path