Skip to content

Instantly share code, notes, and snippets.

View cabarbato's full-sized avatar
🍺

Colleen Barbato cabarbato

🍺
  • Florida
  • 05:26 (UTC -04:00)
View GitHub Profile
@cabarbato
cabarbato / mkdirs.bash
Created January 18, 2021 17:47
Iterate through a .txt file and make a new folder for each line
#!/bin/bash
input_file="input.txt"
while read -r folder;
do mkdir "$folder";
done < "$input_file"
@cabarbato
cabarbato / concat.bash
Last active April 29, 2022 14:49
quickly concat all csv's within a folder; pass a new file name if you want
#!/bin/bash
[[ $1 ]] && output_file="$1.csv" || output_file="output.csv"
i=0
for input_file in ./*.csv; do
if [ "$input_file" != "$output_file" ] ;
then
if [[ $i -eq 0 ]];
then
@cabarbato
cabarbato / concat.py
Created January 8, 2021 20:26
A script that concatenates all csv's within all subfolders
import os
import csv
input_path = './input'
output_path = './output'
# If you don't have an .env set up, just pass a string here of what you want the first column name to be.
# Ideally it's descriptive of what the folders are organized by. For example, if the folders are all named after
# different months in a calendar year, "months" would be a good string to pass.
folder_type = os.environ["FOLDER_TYPE"]