Date Modified - Folder

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Date Modified - Folder Sun Jun 05, 2016 12:32 am • by laurie_lewis
Hi,

I am trying to get a process to work on a large folder structure on a Synology NAS. Connecting to it via SMB. The Folder structure is similar to:-

Code: Select all
Share - Top Folder 1  -  Folder 1 - Folder A
                                                 - Folder B
                                                 - Folder C
                                   
                                    Folder 2 - Folder D
                                                 - Folder E
                                                 - Folder F

          - Top Folder 2 - Folder 2 - Folder G
                      etc


Files are kept in the folders indicated by a Letter. There can be up to 20 folders by letter in each of the folders by number. There are hundreds of folders by number. The folders are created automatically by another process and files placed into them as needed. Files in the folders are accessed generally only for a short time (week to month) and then may never be edited again but need to be retained.

So my search is setup as
Code: Select all
Kind is folder
Last time matched is not today (only process once a day)
Date last modified is in the last month

then

run rules on folder contents


I am setting it ups this way using the date last modified so that the scan is fairly quick as there are a HUGE number of files and the changes as indicated early are limited.

The second part of the process is the moving of these files from my laptop to the network share.

Hazel is monitoring a folder so that when a new file is created it is renamed according to another full rule and given a colour label (working fine).

The next rule Hazel will matched in relation to this folder is:

Code: Select all
Based on the colour label it is then moved to Top Folder 1/2/etc
Sort into Subfolder based on Name
Add appropriate Tags
remove colour label


All working fine here but the file continues to need to be monitored. When the renamed file is placed into the Folder with a letter the modified date for that bottom folder is changed. But, the folder with the number (1 level up) does not appear to have it's modified date changed. Therefore the first rule I described might never get to the file in the folder below on some occasions.

Is there anyway to ensure that when the file is sorted that all folders in the path to where the folder is moved have the modified date changed. I thought it was done automatically but when I run the view option on a folder I know has just had a file placed in a sub folder, I can see that the date modified has not updated/changed.

Thanks

Laurie
laurie_lewis
 
Posts: 23
Joined: Thu Mar 14, 2013 11:53 pm

Re: Date Modified - Folder Sun Jun 05, 2016 1:17 am • by laurie_lewis
Think I figured it out using DirName and Touch but yet to fully test with the variable $1

Code: Select all
touch -m $(dirname $(dirname $1))
laurie_lewis
 
Posts: 23
Joined: Thu Mar 14, 2013 11:53 pm

Re: Date Modified - Folder Mon Jun 06, 2016 10:54 am • by Mr_Noodle
I'm not sure if it's necessary to touch the folder. You can set up the rules to have Hazel go into the subfolders. It should be smart about only going into the folders which have file events.

That said, if you do use that script, remember to put double-quotes (") around $1 just in case there are spaces in the path.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support