Skip to content

Commit 24114e2

Browse files
mawasileianjensenisme
authored andcommitted
Refactor code structure for improved readability and maintainability
(cherry picked from commit 9802e25)
1 parent 659e116 commit 24114e2

11 files changed

+6
-3
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

data/upload_data.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ if ($ContainerExists -ne "true") {
5252
Write-Host "Container '$ContainerName' already exists." -ForegroundColor Green
5353
}
5454

55+
$LocalFolder = $LocalFolder + "/sample_data"
5556
# Upload all PDF files from the current directory
5657
Write-Host "Uploading PDF files from '$LocalFolder' to container '$ContainerName'..."
57-
Get-ChildItem -Path $LocalFolder -Recurse -Filter *.pdf | ForEach-Object {
58+
Get-ChildItem -Path $LocalFolder -Recurse -Filter *.* | ForEach-Object {
5859
$FilePath = $_.FullName
5960
$BlobName = $FilePath.Substring($LocalFolder.Length + 1) -replace '\\', '/'
6061
Write-Host "Uploading '$FilePath' as blob '$BlobName'..."

data/upload_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def upload_data_files(
5454
blob_container_client.create_container()
5555
logger.info("Done.")
5656

57-
for file in Path(local_folder).rglob("*.pdf"):
57+
for file in Path(local_folder + "/sample_data").rglob("*.*"):
5858
logger.info(f"Uploading {file} to {storage_container}.")
5959

6060
# construct blob name from file path

data/upload_data.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ else
3333
echo "Container '$CONTAINER_NAME' already exists."
3434
fi
3535

36+
$LOCAL_FOLDER = ${LOCAL_FOLDER}/sample_data
3637
# Upload all PDF files from the current directory
3738
echo "Uploading PDF files from '$LOCAL_FOLDER' to container '$CONTAINER_NAME'..."
38-
for file in $(find "$LOCAL_FOLDER" -type f -name "*.pdf"); do
39+
for file in $(find "$LOCAL_FOLDER" -type f -name "*.*"); do
3940
# Generate a unique blob name by replacing directory separators with underscores
4041
BLOB_NAME=$(echo "$file" | sed "s|$LOCAL_FOLDER/||" | tr '/' '_')
4142
echo "Uploading '$file' as blob '$BLOB_NAME'..."

0 commit comments

Comments
 (0)