Syncing ONLY the 'tree' but not the files?

I finally got things working with my travel laptop only syncing a subset of my directories, as I asked about in Syncing a subset of a directory - possible?, but this has led me to a second question. I can’t find an obvious way to do it in the ‘Ignoring Files’ section of the docs, and my experiments haven’t worked…

It is a bit of a pain to edit the .stignore file to enable the desired files without having a copy of the file tree to look at, so I’d like to sync just the directory tree (possibly only a few levels of it?) without any of the files. This shouldn’t take a lot of space on the laptop drive, and would be a big help in figuring out what I might want to enable.

Is there an ignore pattern that would allow this? (all the machines are Linux boxes if that matters) If there isn’t, is this a feature that could be requested?

Thanks, ex-Gooserider

Ignore patterns don’t distinguish between folders and files specifically, so this isn’t really possible in a reliable way, although you could try doing the following.

*.*

This should ignore everything that has an extension. Of course, the assumption is that all your files do have an extension, and also that no folders have . in their names.

Will give that a try, it hopefully will work as I do try to put extensions on everything and don’t put dots in directory names…

Thanks for the tip.

It might be worth trying to add this, it seems like it should be possible, at least in Linux since the permissions include a directory flag… (not sure how those other operating systems do this…)

ex-Gooserider

I created a test directory to see what I could figure out. It has a bunch of nested directories, each w/ a few minimal .txt files and an .html file on the desktop, and have been trying different ignore patterns on the laptop… The directories have no extensions and the files all do.

Results of different efforts - (star.star doesn’t show properly in the preview, so using “S” as a prefix where it doesn’t show)

  1. No pattern - everything synchs, as expected…

  2. ** - Nothing (as expected)

  3. !** - everything

  4. S*.* - nothing

  5. !S*.* & ** - Everything

  6. !S* & S*.* everything

  7. !* - everything

  8. S* - nothing

So it seems that none of the options I’ve tried will give me JUST the directory tree… Am I missing something?

ex-Gooserider

OOPS - I goofed!!! :melting_face: I didn’t see that some of my attempts to clear the test directory on the laptop also nuked the test directory on the desktop. (fortunately I backed it up!) When I repeated the test again, I found that s*.* did EXACTLY the right thing, and gave me the tree without any files…

Thanks for the suggestion, it DOES work… (Possibly it might be worth adding this as a useful pattern in the docs?)

ex-Gooserider

A followup question - in one of my tests I synched an entire directory, including all the files… Now that I have the right ignore pattern, ST should do the right thing w/ new files, but the synched files are still on the laptop drive even if they are now ignored.

What is the best way to get rid of the files on the laptop, without losing them on the desktop? I couldn’t see anything directly relevant in the docs or FAQ

ex-Gooserider

There is no easy way to do it, I believe. If the ignored files are scattered around different folders and your goal is to make both sides identical, you could set the folder on the laptop to Receive Only, then delete everything except for .stfolder and .stignore, then press “Revert Local Additions” which will re-download everything that’s not ignored.

That almost worked… It cleaned up the laptop directory, except that most of the directory tree didn’t copy over. Now the directory on the desktop machine says it is out of sync. It shows: Out of Sync items - 12 items, ~0B Failed items - 12 items Both list the directories that didn’t show up on the tree in the laptop, and in failed items it gives the error message:

directory has been deleted on a remote device but is not empty; the contents are probably ignored on that remote device, but not locally

How do I fix?

ex-Gooserider

Finally figured this out - putting it down for the record…

I set the DESKTOP machine folder, which had all the subfolders and files on it, including the ones I didn’t want to sync to be a “Send-only” folder.

As described in the docs on ‘folder types’, this triggered it to give me an “Override Changes” button, I hit that, and it apparently resynched the folder, and because of the .stignore file on the laptop, only copied the tree just as I wanted…

So to summarize, the .stignore file on the laptop looks basically like this:

(?i)!/lib*
// Case insensitive match of subdirs to sync.
// I only used enough to give a unique name, 
// repeat as needed for each subdir to sync.

*.*
// ignore any file or directory names that have extensions, 
// sync any that DON'T
// as long as all files have extensions, and directories 
// don't, the tree will be synched and the files won't be.

It might be worth adding this to the docs somewhere? I’m sure I’m not the only person that might want to do this.

As one use case, I could see this as good for people w/ small portable devices w/ limited storage that want a list of what is on their big machines so as to potentially access things without using a lot of space.

ex-Gooserider

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.