var fs=require('fs'); var files=JSON.parse(fs.readFileSync('civitai.info.json')); var moves=files.filter(file=>{ return file.model.nsfw==true && file.mirror_path.indexOf('nsfw') == -1 }); moves = moves.map(file=>{ m=file.mirror_path.replace(/\\/g,'/'); m=m.replace(/models\/([^/]+)\/(.+)/g,'git mv "models/$1/$2" "models/$1/nsfw/$2"'); return m; }).join('\n') fs.writeFileSync('move-nsfw.sh',moves);