anonderpling
commited on
Commit
•
4c9638a
1
Parent(s):
c2c4348
add script to move nsfw files based on civitai.info.json
Browse files- move_nsfw.js +12 -0
move_nsfw.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var fs=require('fs');
|
2 |
+
var files=JSON.parse(fs.readFileSync('civitai.info.json'));
|
3 |
+
var moves=files.filter(file=>{
|
4 |
+
return file.model.nsfw==true && file.mirror_path.indexOf('nsfw') == -1
|
5 |
+
});
|
6 |
+
moves = moves.map(file=>{
|
7 |
+
m=file.mirror_path.replace(/\\/g,'/');
|
8 |
+
m=m.replace(/models\/([^/]+)\/(.+)/g,'git mv "models/$1/$2" "models/$1/nsfw/$2"');
|
9 |
+
return m;
|
10 |
+
}).join('\n')
|
11 |
+
|
12 |
+
fs.writeFileSync('move-nsfw.sh',moves);
|