meganz / MEGAcmd

Command Line Interactive and Scriptable Application to access MEGA
Other
1.94k stars 407 forks source link

Unable to exclude path #588

Open TheCGDF opened 3 years ago

TheCGDF commented 3 years ago

I'm using MEGAcmd and I want to exclude a folder when syncing. According to its user guide, it should be able to exclude a path. However, I find MEGAcmd has some BUGs and it cannot exclude a path but only filenames. I wrote some rules such as mega-exclude -a /root/www/files and reload & restart MEGAcmd, but it does not work at all. If I wrote filename like mega-exclude -a index.html, it will work. I can find some people have the same problems but no solution.

JuanuSt commented 2 years ago

I have the same problem.

polmr commented 2 years ago

We will soon release a new version that has that fixed. Apologies for the inconvenience

paulo27ms commented 2 years ago

Any updates on this? 😃 Still facing the same issue sadly.

JuanuSt commented 2 years ago
#!/bin/bash

# Folders
folders=("Images" "Music" "Videos" "Folder_x")

# Log in account
current_login=$(/usr/bin/mega-whoami | cut -d ':' -f2 | tr -d ' ')
if [[ "$current_login" == 'err' ]];then
    echo "Login into account"
    /usr/bin/mega-login $email $passwd
    /usr/bin/mega-whoami
elif [[ "$current_login" == $email ]];then  # Check that is the account that you want (I have several of them)
    echo "Logged into $current_login"
else
    echo -n "Logged into account: "
    echo "${current_login}"
    exit
fi

# Sync folders listed above
old_IFS="$IFS"
IFS=$'\n'
for folder in ${folders[@]};do
   echo "Sync ${folder}"
   /usr/bin/mega-sync "/local/path/${folder}" "/remote/path/${folder}"
done
IFS="$IFS"

# Show syncs
/usr/bin/mega-sync

exit
paulo27ms commented 2 years ago

It's an option but I want to sync 400 folders except for 100 of them that start with certain characters and I want the syncing to be continuous not occasional. Could still get a script together to do it continuously and dynamically but I'll believe in an update to this issue. 😋

JuanuSt commented 2 years ago

I recognize it is not very practical.

But you could filter the 400 folders and discard the others 100 folders: ls | grep -v common_chars_100_folders* | sed 's/^/"/' | sed 's/$/"/'

Copy the results to the script folder variable.

Create a cronjob to run this script after reboot: @reboot ~/scripts/start_megaCMD_syncs.sh

paulo27ms commented 2 years ago

I see, I wasn't considering sync every single folder (because I sync the main folder and exclude what I don't want), the other way around is an option too. Thanks for the tips. 😄

JuanuSt commented 2 years ago

You welcome :). And sorry, I just wanted to share my personal (and temporary) solution.