Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/walmart_CSVs
/.vscode
/walmart_API_Debug_Tools/walmart_API_Taxonomy/taxonomy_categories.csv
/walmart_API_Debug_Tools/walmart_API_Taxonomy/taxonomy.json
RecipesDataset.csv
.DS_Store
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"colors" : [
"colors": [
{
"idiom" : "universal"
"idiom": "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"images" : [
"images": [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
},
{
"appearances" : [
"appearances": [
{
"appearance" : "luminosity",
"value" : "dark"
"appearance": "luminosity",
"value": "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
},
{
"appearances" : [
"appearances": [
{
"appearance" : "luminosity",
"value" : "tinted"
"appearance": "luminosity",
"value": "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}
6 changes: 3 additions & 3 deletions SWFrontUI/ShopwiseFrontEndUI/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}
64 changes: 64 additions & 0 deletions deleteEmptyCSVs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import fs from 'fs';
import path from 'path';

const TARGET_DIR = 'walmart_CSVs';

/* -------------------- helpers -------------------- */

function isEmptyCSV(filePath) {
const stat = fs.statSync(filePath);

// Truly empty file
if (stat.size === 0) {
return true;
}

const content = fs.readFileSync(filePath, 'utf8').trim();
if (!content) {
return true;
}

// Header-only CSV (1 line)
const lines = content.split(/\r?\n/);
return lines.length <= 1;
}

/* -------------------- main -------------------- */

function main() {
const dirPath = path.resolve(process.cwd(), TARGET_DIR);

if (!fs.existsSync(dirPath)) {
console.error(`Folder not found: ${dirPath}`);
process.exit(1);
}

const files = fs.readdirSync(dirPath);

let deleted = 0;
let checked = 0;

for (const file of files) {
if (!file.toLowerCase().endsWith('.csv')) {
continue;
}

const filePath = path.join(dirPath, file);
checked++;

try {
if (isEmptyCSV(filePath)) {
fs.unlinkSync(filePath);
deleted++;
console.log(`Deleted empty CSV: ${file}`);
}
} catch (e) {
console.warn(`Failed to process ${file}: ${e.message}`);
}
}

console.log(`\nChecked ${checked} CSV files`);
console.log(`Deleted ${deleted} empty CSV files`);
}

main();
Loading