aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

Create archive the dst folder check need to happen before the dump and compress start

Open unkcpz opened this issue 1 year ago • 5 comments

When dumping data to the archive with verdi archive create, it takes hours to create the export.zip but the command failed because of the dst folder does not exist. It'll be very helpful if the check can happen before or automatically create a folder with mkdir -p.

unkcpz avatar Nov 02 '23 14:11 unkcpz

Hey can I work on this?

prady0t avatar Nov 05 '23 07:11 prady0t

Sure, please go ahead. Pinging me if you need a review or help :)

unkcpz avatar Nov 05 '23 22:11 unkcpz

#!/bin/bash

# Get user input for the command, source folder, and destination folder
read -p "Enter the command for dumping/archiving: " custom_command
read -p "Enter the source folder: " source_folder
read -p "Enter the destination folder: " destination_folder

if [ ! -d "$destination_folder" ]; then
    mkdir -p "$destination_folder"
fi

if [ -d "$destination_folder" ]; then
    # Execute the user-provided command with source and destination folders
    eval "$custom_command" "$source_folder" "$destination_folder"
else
    echo "Failed to create destination folder or it does not exist. Exiting..."
    exit 1
fi

AryanNanda17 avatar Jan 09 '24 15:01 AryanNanda17

I think this will resolve the bug. I am not sure

  • where to make the file data_dump_script.sh
  • what is the destination path and the source folder.
  • what is the custom dump command.

AryanNanda17 avatar Jan 09 '24 15:01 AryanNanda17

@unkcpz Please help me with that.

AryanNanda17 avatar Jan 09 '24 15:01 AryanNanda17