// Opens any object at the specified path
$file = filesystem('server1')->get('files/myfile.txt');
// Opens an object at the specified path only if the file type matches 'File'
$file = filesystem('server1')->get('files/myfile.txt','File');
// Opens an object at the specified path only if the file type matches one of 'File' or 'Link'
$file = filesystem('server1')->get('files/myfile.txt',['File','Link']);
// For file types other than Directory and Socket, the file is only committed to disk when you call save()
$file = filesystem('server1')->new('files/myfile.txt');
$file->write('mydata')->save();
$file = filesystem('server1')->new('files/myfile.txt')->write('mydata')->save();
// If file type is Directory or Socket, it is automatically created. You do not need call save()
$dir = filesystem('server1')->new('files/subdir','Directory');
For Sockets, new() creates a server socket, open() connects to a server socket
$file = filesystem('server1')->open('files/myfile.txt');
$file->append('mydata')->save();
$dir = filesystem('server1')->open('files/subdir','Directory');
$file = filesystem('server1')->get('files/myfile.txt');
$dir = filesystem('local')->get('subdir1');
$newdir1 = filesystem('local')->open('subdir2');
$newdir2 = filesystem('server1')->open('subdir3');
$newfile = $file->copyTo($newdir1);
$moveddir = $dir->moveTo($newdir2);
// Copying files and directories into ZIP or tar files is the same as copying them to regular folders
// Open ZIP file and set the pointer to whatever
$backup1 = filesystem('local')->open('backup/backup.tar.gz','TarFile');
$backup2 = filesystem('server1')->new('backup/backup.zip','ZipFile');
$backup3 = filesystem('local')->open('backup/backup.tar','TarFile');
$dir->copyTo($backup1);
$backup1->compress(9);
$dir->moveTo($backup3);
$backup3->compression('gzip')->compress();
$file->moveTo($backup2);