You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
1 year ago
|
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
}
|