#bash #Help > Delete a Folder in all #BTRFS snapshots.

So my server ran full, and it has years of snapshots, i actually do not want to delete, however i spotted (with the amazing ndcu) some 500GB of Backups i do not need. So i want to delete them.

apparently to do this you need to set each snapshot to writable and delete the file/folder you want. (see https://www.suse.com/support/kb/doc/?id=000019594)

they have also a script there doing this in a handle able manner. however it is only for Files and not for Folders. But i need to delete Folders. Ideally i want to be ably to provide the path to it so i do not delete some identically named folders elsewhere.
I tried to adapt the script but i do not quiet understand it.

original script
```
file=$1

while read a
do snapshot=$(echo ${a%%/$file})
btrfs property set $snapshot ro false
rm -f $a
btrfs property set $snapshot ro true
done < <(find /.snapshots/ -name $file)

**question 1:**
what does this line exactly do?

do snapshot=$(echo ${a%%/$file})
```
question 2
in what way/order does this "< <" syle of conding feed the paths to the loop?

because this (my for folders adapted test script)

file=$1 
while read a
         do snapshot=$(echo ${a%%/$file})
echo "$snapshot snpsho"
          # btrfs property set $snapshot ro false
           #rm -rf $a ## delete command adapted for folders
                echo "foundet $a"
           #btrfs  property set $snapshot ro true
         done < <(find /home/ -type d -path $file) ## find command adapted for folders and paths


this does not give me any output, altough the find command on its own totally does

rant

also why, do we still not have tools that do make sense with btrfs filesystems. like:
- gui option in filemanager to delete a file/folder though all spanshots
- gui option in filemanager to easily compare/resore older versions of a file. (like windows)
this should be quiet easy and would be heavily helpfull...

#linux #btrfs #shell #community #snapshot #storage #admin

8