Hi there.
I am still learning so please be patient.
I have a bunch of csv format files in a bunch of folders with the following format:
/home/user/folder/year-month-day/a.csv
/home/user/folder/year-month-day/b.csv
/home/user/folder/year-month-day/c.csv
/home/user/folder/year-month-day/d.csv
.....
/home/user/folder/year-month-day/n.csv
Every day a new folder is created, and the the data collected is put into the csv files with the same names.
I have changed the behaviour of the script to create another csv file elsewhere. Now, the csv files are updated all the time, but in one big file instead of many little csv files spread across a bunch of folders created every day. This makes importing all the data together easier for other programs.
But I still have all the previous data gathered before today in seperate folders.
Could somebody please help me putting all the a.csv, b.csv ... n.csv files together into one A.csv, B.csv .... N.csv file in the same order they are classified in their original folder?
Thanks.
SOLVED! Fetching files with same names from folders in alphabetical order.
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
SOLVED! Fetching files with same names from folders in alphabetical order.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
SOLVED! Fetching files with same names from folders in alphabetical order.
SOLVED! A good nights rest help me solve this embarrasingly simple task all by my self. This is what I did:
Code: Select all
#!/bin/bash
names=("a" "b" "c" "d" "e" .........."z")
i=1
while [ "$i" -le 30 ]; do
for j in "${names[@]}"
do
cat /home/user/Documents/folder/2021-03-$i/$j >> /home/user/Documents/folder/$j
done
i=$((i+1))
done