this post was submitted on 10 Jun 2025
74 points (92.0% liked)

Programmer Humor

36533 readers
275 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 week ago (1 children)

Check if a CSV exists and if it does rename to the filename_date.CSV and upload to hdfs

[–] [email protected] 3 points 1 week ago (1 children)

here's what DeepSeek gave me for the following prompt: write a small bash script to check if a CSV exists and if it does rename to the filename_date.CSV and upload to hdfs, keep it simple

#!/bin/bash

# Check if filename argument is provided
if [ $# -eq 0 ]; then
    echo "Usage: $0 <csv_filename>"
    exit 1
fi

CSV_FILE="$1"

# Check if file exists
if [ ! -f "$CSV_FILE" ]; then
    echo "Error: File $CSV_FILE not found!"
    exit 1
fi

# Generate new filename with date (YYYYMMDD format)
DATE=$(date +%Y%m%d)
NEW_FILENAME="${CSV_FILE%.*}_${DATE}.csv"

# Rename the file
mv "$CSV_FILE" "$NEW_FILENAME"

# Upload to HDFS
hdfs dfs -put "$NEW_FILENAME" /path/to/hdfs/directory/

echo "Successfully processed: $NEW_FILENAME"
[–] [email protected] 2 points 6 days ago (1 children)

OK at least it didn't create functions for everything. ChatGPT had a function to kinit, to rename and to upload to hdfs. And each function had 2-3 line comments. I mean for a single command how can you put 3 lines of comments.

[–] [email protected] 2 points 6 days ago

I've never touched ChatGPT out of principle, but everything I hear about it makes it sound like hot garbage.