Skip to main content

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

Backup folders names by the recoding date

Comments

2 comments

  • Paul Steunebrink
    Not possible, a sorely missing function, if I may say.
    0
  • Alexander Maier
    Thank you for the answer. I miss this feature, too. Actual I use a script to move the files from the Capture Backup directory to my backup structure:

    #!/bin/bash
    #
    #bash script to move files into subdirectories by create date
    #
    #known bugs:
    #if filename exist in destination directory it will be overwritten!
    #
    source_path="/Volumes/SONY/Import/" #Path to your source files
    destination_path="/Volumes/SONY/" #Path to your destination directories

    #replace blanks in filenames with _
    find $source_path -name "* *" | while read a ; do mv "${a}" "${a//' '/_}" ; done

    #find all files in source path and start a loop
    for i in $( find $source_path -type f -iname \*.*);
    do

    #get creation date of file YYYY-MM-DD, set destination directory, set filename
    create_date=`stat -l -t "%F %T %z" $i | grep -E -o [[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} | head -n 1`
    destination_directory="$destination_path/$create_date"
    filename=`basename $i`

    #check destination directory
    if [ ! -d $destination_directory ];
    then
    mkdir -p $destination_directory
    else
    fi

    mv $i $destination_directory
    echo "moving: $i -> $destination_directory";
    done
    exit 0
    0

Post is closed for comments.