2

I have an issue with a combination of the Facebook and Google Photos apps on my Pixel 4 XL.

The folder Facebook stores the images you save from it is in the DCIM folder. Photos you take with your phone camera are also in the DCIM folder, in a Camera subfolder. Google lops all content within the DCIM folder into a virtual folder called Camera, completely ignoring the subfolder structure within DCIM. So whenever you have to navigate folder structures to select an image, both the images saved on Facebook and the ones taken with the camera are shown in the same location of the virtual Camera folder - the actual subfolders are hidden by the virtual folder.

This is problematic because Google photos can't distinguish these subfolders either. The option to back up files with Google One can only be set on the virtual folder level. So, I can either back up my camera photos AND any Facebook images I've saved, or nothing. I save a lot of memes and they're cluttering up my Google photos. I want to stop backing up the Facebook images.

As far as I can see it, any of the following would solve my problem

  • Facebook saves to a different folder not within existing DCIM folder
  • Facebook allows you to select which folder to save files in
  • Android doesn't allow virtual folders to totally obscure physical folders, to where we could still specify not to back up the Facebook directory in Google Photos
  • Google Photos offers some ability to control when backups occur (eg only when charging so I could move the files before they're backed up)
  • Google Photos has the concept of a bidirectional sync to where local deletion/movement removes the backed up copies

None of these appear to be offered. The one path I did go down myself was installing the app FolderSync which is supposed to be able to instantly move files from one folder (DCIM/Facebook) to another (just Facebook, with Photos backup disabled on that folder). It seems to move the files right as they're saved, but it does not seem to preempt Google Photos from indexing and backing up the files first so this doesn't work. It also breaks the media index and I have to restart my phone or use an app that manually triggers a media rescan (or else all the original files in the DCIM subfolder appear as error thumbnails during media selection, and the destination ones don't appear).

There are a bunch of posts on reddit and Google support forums about this with no fix indicated. This has been bugging me for many reasons - wastes Google One storage, clutters it up so it's harder to find actual images I took (probably have 10x as many images saved from Facebook vs photos I took), didn't exist in earlier Android versions and would've been able to avoid it with control options that have since been removed, etc.

2
  • This is somewhat tedious but you can do this, provided your device is rooted: 1) setup island app (which uses work profile user) and install facebook app in it. Because work profile is a separate user, its dcim folder would also be different, and therefore, free from google one's reach (unless you setup a Google photos backup in work profile too). 2) another solution is to use storage Redirect app. It would provide a separate dcim folder for Facebook but it wouldn't be under Photos backup path. I don't know how well this would work with media indexing.
    – Firelord
    Commented Sep 9, 2020 at 19:44
  • 1
    May I Offer some cheese in these trying times: using any decent file explorer, create a .nomedia file inside the Facebook folder. Google Photos will then be blind to that folder, maybe needing a restart first. The downside is that your standard ways of viewing thr folders contents won't work as well - you'll need the same file explorer to look at your downloaded Facebook images.
    – Dan Brown
    Commented Sep 16, 2020 at 15:26

1 Answer 1

0

Use my beginner friendly Tasker project which I made based on this answer. I made some significant improvements that allow it to be used for many other scenarios beyond just moving Facebook's images, and included multiple examples within the project to learn from:

  1. While the original version could detect if the file being moved already existed in the destination directory, it could only handle one iteration of the conflict. For example, if example.jpg were being moved, but it already existed, it would rename the file being moved to example(1).jpg. However, if example.jpg were being moved and both example.jpg and example(1).jpg already existed, it would simply overwrite example(1).jpg.
    • My version will run an iterative check on names which increments the suffix variable until a non-existing name is found. For example, if example.jpg is taken, it will check example(2).jpg. If that is taken, it will check example(3).jpg, and so on until an available name is found. It also correctly appends the first duplicate with (2) rather than (1).
  2. The original version assumed the first "." in a file name was also the last "." before the extension. While this is fine for images from Facebook, it's not an ideal assumption, and breaks down when adopting the task for other uses, such as moving APKs. With the original, if com.example.app.apk already existed in the destination directory, trying to move a second copy of it would result in com(1).example.app.apk.
    • In addition to fixing the suffix and making it iterative, I've also changed the logic for its placement, such that it will always go before the last ".". In the above example, the apk would now be renamed to com.example.app(2).apk. This doesn't always work perfectly (consider .tar.gz and other similar cases for instance), but it does a good enough job without having to hard-code in every possible extension.
  3. This appears to vary from device to device, but on my devices, the original version would leave behind broken references to images in gallery apps and other programs that utilize the media provider (most messaging apps that have an image selection UI) due to not correctly refreshing this data. This was not an issue for moving images out of a directory containing a .nomedia file, but caused issues if you wanted to use it in a directory where you didn't want or couldn't have a .nomedia file (such as automatically moving downloaded images out of /sdcard/Download/).
    • Tasker's Scan Media action seems to act in wildly different ways depending on not only the Android version, but also the vendor variant you're using. I've fixed the issue on my devices (and hopefully many of yours) by running a Scan Media action on not only the file in it's destination directory, but also on the original file path (referencing the file that's no longer there).

I also updated variable names for clarity, and rather than using events that trigger when entering or exiting apps, I've set it to run on a File Modified event monitoring the source folder, with the event set to Closed Write. This works for most purposes, but breaks in some cases. You can fix most issues by either using a different event parameter (such as Create, Modify, or Move To) or by using stricter regex in Action 3 of the task.

I've heard that devices with slower storage (or slow external SD cards) can have issues with this if files take too long to write. In that case, you may have to experiment with adding delays or using different methods to trigger the task.

I'm attaching not just the task here, but the entire project I've created, containing multiple copies of the task for various use cases, and their respective profiles to trigger them, so that beginners who are new to Tasker can easily get started using this task and have some examples to reference when adopting the task to their own needs.

The examples included in this project are:

  • When Facebook downloads an image to /sdcard/DCIM/Facebook, move it to /sdcard/Pictures/Facebook.
  • When Samsung Notes saves an image to /sdcard/DCIM/Samsung Notes/, move it to /sdcard/Pictures/Samsung Notes/. (This works, but Samsung Notes will claim it failed to save the image, due to it checking for the image after it has already been moved by Tasker.)
  • When you create a GIF using Smart Select, move it from /sdcard/DCIM/GIF/ to /sdcard/Pictures/Smart Select GIFs/.
  • When you export an APK from ReVanced Manager to /sdcard/Download/APKs/Original/, move it to /sdcard/Download/APKs/Modded/.
  • When a new file is detected in /sdcard/Download/ . . .
    • if it's a download from Craiyon, move it to /sdcard/Pictures/Craiyon/
    • if it's an APK, APKM, APKS, or XAPK file, move it to /sdcard/Download/APKs/Original, unless it is base.apk (I leave that file in Download since I use it for other things.)

Remember to first create the source and destination directories before testing the examples. I also encourage you to check Action 3 in each example task (some of them use simple matching and others use regex) for a better understanding of how they work.

Now that that's out of the way, here's the project. You can import it directly to Tasker from there, or download it as an XML. If you choose to download it, save it in /sdcard/Tasker/projects/. You can then long press on the home icon on the bottom left corner of Tasker to import the project.

Unfortunately the entire XML is too long to post here directly, but for the sake of keeping this answer as complete as possible, I'm including the XML for just the Facebook task below. I strongly recommend that beginners import the entire project using the link above however, so you can get an idea of how to customize the task for your own needs.

The Facebook task:

<TaskerData sr="" dvi="1" tv="6.0.10">
    <Task sr="task3">
        <cdate>1489093858387</cdate>
        <edate>1677367714628</edate>
        <id>3</id>
        <nme>Move Facebook Images</nme>
        <pri>6</pri>
        <Kid sr="Kid">
            <launchID>3</launchID>
            <pkg>me.regalstreak.movefb</pkg>
            <vTarg>21</vTarg>
            <vnme>1.0</vnme>
        </Kid>
        <Action sr="act0" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%sourcedir</Str>
            <Str sr="arg1" ve="3">/sdcard/DCIM/Facebook/</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act1" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%destdir</Str>
            <Str sr="arg1" ve="3">/sdcard/Pictures/Facebook/</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act10" ve="7">
            <code>37</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%fileexists</lhs>
                    <op>12</op>
                    <rhs></rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act11" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%currentfilename</Str>
            <Str sr="arg1" ve="3">%currentfilepath(%pathlen)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act12" ve="7">
            <code>888</code>
            <Str sr="arg0" ve="3">%suffix</Str>
            <Int sr="arg1" val="1"/>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act13" ve="7">
            <code>590</code>
            <Str sr="arg0" ve="3">%currentfilename</Str>
            <Str sr="arg1" ve="3">.</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act14" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%namelen</Str>
            <Str sr="arg1" ve="3">%currentfilename(#)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act15" ve="7">
            <code>890</code>
            <Str sr="arg0" ve="3">%namelen</Str>
            <Int sr="arg1" val="1"/>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act16" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%currentfilename(%namelen)</Str>
            <Str sr="arg1" ve="3">%currentfilename(%namelen)%null()(%suffix)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act17" ve="7">
            <code>592</code>
            <Str sr="arg0" ve="3">%currentfilename</Str>
            <Str sr="arg1" ve="3">.</Str>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act18" ve="7">
            <code>135</code>
            <Int sr="arg0" val="0"/>
            <Int sr="arg1" val="10"/>
            <Str sr="arg2" ve="3"/>
        </Action>
        <Action sr="act19" ve="7">
            <code>38</code>
        </Action>
        <Action sr="act2" ve="7">
            <code>412</code>
            <Str sr="arg0" ve="3">%sourcedir</Str>
            <Str sr="arg1" ve="3">*.jpg/*.png/*.jpeg/*.gif/*.3gp</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Str sr="arg5" ve="3">%filelist</Str>
            <Int sr="arg6" val="1"/>
        </Action>
        <Action sr="act20" ve="7">
            <code>400</code>
            <Str sr="arg0" ve="3">%currentfilepath</Str>
            <Str sr="arg1" ve="3">%destdir%currentfilename</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="1"/>
        </Action>
        <Action sr="act21" ve="7">
            <code>459</code>
            <Str sr="arg0" ve="3">%currentfilepath</Str>
        </Action>
        <Action sr="act22" ve="7">
            <code>459</code>
            <Str sr="arg0" ve="3">%destdir%currentfilename</Str>
        </Action>
        <Action sr="act23" ve="7">
            <code>888</code>
            <Str sr="arg0" ve="3">%counter</Str>
            <Int sr="arg1" val="1"/>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act24" ve="7">
            <code>40</code>
        </Action>
        <Action sr="act25" ve="7">
            <code>37</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%counter</lhs>
                    <op>0</op>
                    <rhs>0</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act26" ve="7">
            <code>548</code>
            <Str sr="arg0" ve="3">No memes? Sad.</Str>
            <Int sr="arg1" val="0"/>
            <Str sr="arg10" ve="3"/>
            <Int sr="arg11" val="1"/>
            <Int sr="arg12" val="0"/>
            <Str sr="arg13" ve="3"/>
            <Int sr="arg14" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
            <Str sr="arg5" ve="3"/>
            <Str sr="arg6" ve="3"/>
            <Str sr="arg7" ve="3"/>
            <Str sr="arg8" ve="3"/>
            <Int sr="arg9" val="1"/>
        </Action>
        <Action sr="act27" ve="7">
            <code>43</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%counter</lhs>
                    <op>0</op>
                    <rhs>1</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act28" ve="7">
            <code>548</code>
            <Str sr="arg0" ve="3">%counter meme moved!</Str>
            <Int sr="arg1" val="0"/>
            <Str sr="arg10" ve="3"/>
            <Int sr="arg11" val="1"/>
            <Int sr="arg12" val="0"/>
            <Str sr="arg13" ve="3"/>
            <Int sr="arg14" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
            <Str sr="arg5" ve="3"/>
            <Str sr="arg6" ve="3"/>
            <Str sr="arg7" ve="3"/>
            <Str sr="arg8" ve="3"/>
            <Int sr="arg9" val="1"/>
        </Action>
        <Action sr="act29" ve="7">
            <code>43</code>
        </Action>
        <Action sr="act3" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%suffix</Str>
            <Str sr="arg1" ve="3">1</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act30" ve="7">
            <code>548</code>
            <Str sr="arg0" ve="3">%counter memes moved!</Str>
            <Int sr="arg1" val="0"/>
            <Str sr="arg10" ve="3"/>
            <Int sr="arg11" val="1"/>
            <Int sr="arg12" val="0"/>
            <Str sr="arg13" ve="3"/>
            <Int sr="arg14" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
            <Str sr="arg5" ve="3"/>
            <Str sr="arg6" ve="3"/>
            <Str sr="arg7" ve="3"/>
            <Str sr="arg8" ve="3"/>
            <Int sr="arg9" val="1"/>
        </Action>
        <Action sr="act4" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%counter</Str>
            <Str sr="arg1" ve="3">0</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="1"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act5" ve="7">
            <code>39</code>
            <coll>false</coll>
            <Str sr="arg0" ve="3">%currentfilepath</Str>
            <Str sr="arg1" ve="3">%filelist()</Str>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act6" ve="7">
            <code>590</code>
            <Str sr="arg0" ve="3">%currentfilepath</Str>
            <Str sr="arg1" ve="3">/</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act7" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%pathlen</Str>
            <Str sr="arg1" ve="3">%currentfilepath(#)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act8" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%currentfilename</Str>
            <Str sr="arg1" ve="3">%currentfilepath(%pathlen)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
            <Int sr="arg6" val="0"/>
        </Action>
        <Action sr="act9" ve="7">
            <code>342</code>
            <se>false</se>
            <Int sr="arg0" val="4"/>
            <Str sr="arg1" ve="3">%destdir%currentfilename</Str>
            <Str sr="arg2" ve="3">%fileexists</Str>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="1"/>
        </Action>
        <Img sr="icn" ve="2">
            <cls>com.facebook.katana.LoginActivity</cls>
            <pkg>com.facebook.katana</pkg>
        </Img>
    </Task>
</TaskerData>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .