Page 1 of 1
How to Copy a Hidden Directory

Posted:
Sun Dec 17, 2023 5:15 pm
by klind
I would like to copy a hidden folder. I have tried the following and didn't get positive results:
If Any
Any File
If Any
Any File
Name Starts With .
If Any
Any File
Name is .HiddenFolder
None of these work the parent folder contains many files and folders with two hidden folders. How can I get an exact copy of everything including the hidden folders?
Re: How to Copy a Hidden Directory

Posted:
Mon Dec 18, 2023 10:30 am
by Mr_Noodle
Hazel does not process invisible files. If you want Hazel to do so, you will need to set a hidden default. Please see this post:
viewtopic.php?f=3&t=415
Re: How to Copy a Hidden Directory

Posted:
Mon Dec 18, 2023 6:06 pm
by klind
defaults write com.noodlesoft.Hazel ScanInvisibles -bool YES
That's interesting. However, I would presume that running this command would allow for all invisible files to be subject to copying. This would present a problem for me. I am running Obsidian which creates two invisible folders necessary for a viable backup. Still, I wouldn't want to copy every invisible file.
I have Hazel copy all files in my ~user folder to a second hard drive for backup. This includes Obsidian, but it doesn't copy the two Obsidian invisible folders that I need. Is there a way to set Scaninvisibles to specific folders?
Re: How to Copy a Hidden Directory

Posted:
Tue Dec 19, 2023 10:38 am
by Mr_Noodle
You need to add conditions to your rules to match the right files. Even with ScanInvisibles turned on, you still need to specify rule logic to work on the correct files.
Re: How to Copy a Hidden Directory

Posted:
Wed Dec 20, 2023 4:11 pm
by klind
I have conditions. I am using those conditions to copy everything to have an onsite backup. This works fine except for the two hidden Obsidian directories which if not backed up Obsidian becomes useless. If I were to turn on Invisibles I would then need to list 21 directories to skip and then try to keep up with changes and/or additions. I just thought it might be significantly easier to find a way to back up a couple of specific hidden directories. The post you referred me to also shows the ability to specify certain directories in the command 'IgnoredBackupDirs'. Is it too much to ask the same for 'ScanInvisibles'?
Is there another way to tackle this situation? Is it possible (with Hazel) to rename a hidden directory, perform the copy, and then rename it back? Or how about somehow using a script file? I'm seeking a solution and I hope you or another reader may be able to provide.
Re: How to Copy a Hidden Directory

Posted:
Fri Dec 22, 2023 10:33 am
by Mr_Noodle
Why not match the two obsidian directories? You can filter out the rest of them files/dirs that start with ".".
Re: How to Copy a Hidden Directory

Posted:
Fri Dec 22, 2023 3:34 pm
by klind
I thought about that and it is doable. Still, it leaves a bit to be desired as I might need to filter out hidden directories in every rule I currently have and every rule I make in the future. My Obsidian folder is in the iCloud folder. I have several hard drives. Two 5GB drives and two 12GB drives. I use Hazel to make copies of these drives, some from the root. I will need to remember to add the filter and that isn't very easy. But I can do that for now.
Request you consider a future change to Hazel that would allow for setting specific hidden folders for Hazel action.
Regards,
Ken