+ Drive cleanup

This is the answer.

This is the answer.

ok. all hopes finally gonne then.

So i will delete LOTS of my sample content on the DT and will see how much of my projects still work, and which ones not.

its just a mess on my +Drive.
need to get a better workflow overall.
also since i got a feel what type of samples suits my DT workflow :wink:

Thanks for the very valuable Input “tnussb” !

Backup at least all your sample off the dt first. Because the dt identifies sample though a hash system, You should be able to organize and retransfer your samples and they should repopulate the spots in the projects properly as long as they are the samples you pulled off the dt.

1 Like

There is a way how I clean up a mess on Digitakt with using of elk-herd application and a couple of scripts.
I have a few Live projects on my Digitakt which contain samples I would like to preserve. Say I would like to remove all samples from drive except them.
I copy all samles from Digitakt with Elektron Transfer to my computer.
Then I connect to Digitakt with elk-herd app, go to the tab Project and fetch one of the projects.
I open the console in Chrome and write a line:
$('.bank-name').map(function() { return this.innerText; }).toArray().filter(o => o != "" && o != "UNTITLED").join("\r\n")
All my patterns are called “UNTITLED” by default, so this line gives me a list of sample names from Samle Pool. I copy the result string to a file and then repeat for other projects adding the sample lists to the same file.
Then I copy this file to the directory which I copied all my samples from Digitakt to and name it as “input.txt”
I run a file which contains a bash script (in Windows it can be run with Git Bash):

output_dir="..\_ElektronBackup"
output_file="output.txt"
input_file="input.txt"

sed -i.bak s/$'\r'//g $input_file
> $output_file
rm -r ./$output_dir
mkdir $output_dir
while IFS='\n' read -r line; do
	line=$line | tr -d '\n';
	line="${line}.wav";
	foundsample=$(find . -name "${line}")
	if [[ $foundsample != "" ]]; then
		cp --parents "$foundsample" ./${output_dir}
	else
		foundsample="!!!"
	fi
	output="${line}: ${foundsample}"
	echo "$output"
	echo "$output" >> ${output_file}
done < ${input_file}

This script finds all wav files with names from input.txt and copies them to a separate directory with same directory structure, in output file I can see which files were found and copied. Then I can clean my Digitakt and upload necessary samples back.

4 Likes

Doesn’t Elk Herd already let you purge unused samples? Or is that just from the current project, not from the +Drive?

1 Like

Correct, it just purges from project and leaves it on the +Drive

Thanks for sharing the scripts/code and steps. This is the only solution I’ve ever seen, apart from a pen and paper :wink:. My +drive is full so I’m tempted to give it a try. Maybe it could be incorporated into a chrome widget or plugin to automate it a bit more…

On a Mac, I followed your instructions and had two problems with the script, so I amended the script for Mac OS and got it to work. My +Drive now has plenty of free space :slight_smile:
PlusDriveScript.sh (506 Bytes)

4 Likes

I (and others, I’m sure) are incredibly interested in this. Would anybody be willing to explain how to implement this for the code challenged like myself, or indeed build this into a friendly interface somehow?

Ask away, I will try to explain. You can open Chrome console: use the keyboard shortcut Ctrl+Shift+J on Windows or Ctrl+Option+J on Mac. When you run that one line of js script in the console you will get text which you should copy to a file with the name input.txt. Then you should create a file with extension .sh with that big bash script in it, for example script.sh, the files should be located in the same directory where all your samples were downloaded from Digitakt to, for example in “C:\ElectronSamples”. On Windows you should download and install Git. On Mac nothing special is needed to be installed. Run the script with a command line like bash script.sh. Make sure you run the command in the directory of the script, for this run something like cd C:\ElectronSamples. Also make sure that the variable output_dir refers to a location outside the directory of the samples. I haven’t tested this on Mac, but I believe it works. If it doesn’t let me know I will fix the script…

I once sent to mzero a request for a feature in elk-herd for saving projects with its samples, he replied that he is probably going to include this in the version 3.1. I think it would be natural to have such feature in his app.

1 Like

Would anyone mind helping me with this on mac? I’ve tried two ways of specifying the output directories in PlusDriveScript.sh and each time the output file turns up in the input directory where the script, input.txt, and wav files are located.

First try, the output folder is a sibling to the input folder inside the parent folder Music:

output_dir="../dtused"

Tried taking the long route with the second try (my name replaced here with xxxxx)

output_dir="/Users/xxxxx/Music/dtused"

Also, the output file appears without any wav files, most likely because my .wav files are separated into their own folders as they were on the DT itself. I should probably get rid of the folders and have the samples directly in the file, shouldn’t I? That would explain why the output file appears but no samples?

Thanks, this is my first time running bash scripts from the terminal.