filter
parent
654e7b0f0b
commit
97dbbb612b
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
const source = './Picturedata';
|
||||||
|
const destination = './PicturedataFiltered';
|
||||||
|
const picturesPath = './Pictures_1024_768';
|
||||||
|
const labelsPath = './Labels_1024_768';
|
||||||
|
|
||||||
|
await Deno.remove(destination, { recursive: true });
|
||||||
|
Deno.mkdir(destination);
|
||||||
|
Deno.mkdir(`${ destination }/${ labelsPath }`);
|
||||||
|
Deno.mkdir(`${ destination }/${ picturesPath }`);
|
||||||
|
|
||||||
|
for await (const category of Deno.readDir(`${ source }/${ labelsPath }`)) {
|
||||||
|
Deno.mkdir(`${ destination }/${ labelsPath }/${ category.name }`);
|
||||||
|
Deno.mkdir(`${ destination }/${ picturesPath }/${ category.name }`);
|
||||||
|
for await (const label of Deno.readDir(`${ source }/${ labelsPath }/${ category.name }`)) {
|
||||||
|
try {
|
||||||
|
console.log(copy `${ source }/${ picturesPath }/${ category.name }/${ label.name }`);
|
||||||
|
await Deno.copyFile(
|
||||||
|
`${ source }/${ picturesPath }/${ category.name }/${ label.name.replace('.png', '.jpg') }`,
|
||||||
|
`${ destination }/${ picturesPath }/${ category.name }/${ label.name.replace('.png', '.jpg') }`,
|
||||||
|
);
|
||||||
|
await Deno.copyFile(
|
||||||
|
`${ source }/${ labelsPath }/${ category.name }/${ label.name }`,
|
||||||
|
`${ destination }/${ labelsPath }/${ category.name }/${ label.name }`,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log('label missmatch found', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue