I've made a simple script to recover files from .stfolder when you need to recover all files.

Because stversions folder renames filesnames with a timestamp, you need to delete that timestamp if you need to recover it.

It's important that in your original files you don't have the char '~' and you have a extension (.pdf, .jpeg, .doc …)

<?php
 
$dir = "fullpath of you directory"; //You may first copy stversions content into a temporal folder to run this script
 
getDirContents($dir);
 
//var_dump(getDirContents($dir));
 
 
function getDirContents($dir, &$results = array()){
    $files = scandir($dir);
 
    foreach($files as $key => $value){
        $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
        if(!is_dir($path)) {
            $results[] = $path;
 
            $temp = super_neteja($path, '~', '.');
 
            $final = str_replace('~' . $temp, '', $path);
            echo $final;
 
            copy($path, $final);
            unlink($path);
 
        } else if($value != "." && $value != "..") {
            getDirContents($path, $results);
            $results[] = $path;
 
        }
    }
 
    return $results;
}
 
function super_neteja($text, $text_ini, $text_fi) {
    $pos_ini = strpos($text, $text_ini);
    $pos_fi = strpos($text, $text_fi, $pos_ini);
 
    if ($pos_fi > 1 && $pos_ini > 1) {
        $res = substr($text, $pos_ini, $pos_fi - $pos_ini);
        $res = str_replace($text_ini, '', $res);
        $res = str_replace($text_fi, '', $res);
        return $res;
    } else {
        return '';
    }
}
Enter your comment. Wiki syntax is allowed:
 
  • daily/recover_files_from_.stversions_folder_when_using_synthing_versioning.txt
  • Last modified: 2019/05/15 12:02
  • by admin