Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Touching dates - please a plugin for this (or help me make a script?)

Featured Replies

Good health to everybody.

 

I have a weird issue, that I am not sure where this came from.
It relates to files I sync from USB disks to my array and these days also back to the USB disks.

I use DirSyncPro (but not a DirSyncPro issue I think since the files have the issue already).

Seems many files have invalid datestamps (like 1969 or the 22nd century)- and the invalid datestamp propagates differently between the NTFS USB disks and unRAID array.

Can someone make a simple plugin OR help me with a script to check the whole array (or per share - and if possible also on the NTFS disks as they are mounted by Unassigned Devices) for invalid datestamps (or possibly anything before 1996 -?- and after current date/time) and touch the files with current date OR a preset date I define? (this will help identify which files were touched afterwards)

Help please?

 

  • Author

Anybody?

Never done this but I would use find on the console with the days option. E.g.:

 

find /mnt/user/yourfolder -type f -mtime +300 -print

 

In the above example - Files older than 300 days will be found.

 

To change that modification time to the current one, you can use the exec option, but be really, really carefully about what you do:

 

find /mnt/user/yourfolder -type f -mtime +300 -exec touch {} \;

 

Disclaimer: Use at your own risk.

 

Edited by hawihoney

  • Author

Clear, thanks.

 

  • Author

Haven't found a way to find future timestamps (obviously because of some error).
Anybody knows?

 

How about:

 

find /mnt/user/yourfolder -type f -mtime -0 -print

  • Author

Here is what I did in the end.

 

First I set the commands to check for invalid dates.

find /mnt/user -type f -mtime 8500 -ls
## Consider before early 1997 that the dates are invalid and usually they are. ##
## Note that Windows and Linux showed some of them DIFFERENTLY ##
## meaning "edge" dates behave differently between the two OS! ##
find /mnt/user -type f -newermt today -ls
## I didn't find parameter "today" mentioned anywhere but suspected it works and from my checks, it does. ##

Interesting trivia with -mtime 8500 (which is January 29 1997 if run today), is that few files (with obviously invalid dates) showed up at January 29, 28 and 27 of 1997, but no file before that date! Any ideas what OS intricacy does that?

When I rerun the tests (after touching), with -mtime 8000 (1.5 years newer datestamp) no files showed up...
Anyway, when the above two checks list at least one file, I run the corresponding commands below:

find /mnt/user -type f -mtime 8500 -ls -exec touch {} -t 2001010123 \;
find /mnt/user -type f -newermt today -ls -exec touch {} -t 2001010123 \;

I then run the "check only" versions again to verify that the files where indeed touched (so, not listed) and it worked. Also checking from my Windows machine indeed touched files showed as modified in the specific date/tame I use as placeholder (easy to find them later as I don't think I indeed modified any files at 01:23 of January 1st 2020).

 

I actually did the above on a per disk basis (so not /mnt/user) but now I trust it enough to use it on the full array (except if I know where the problem lies exactly) and also not run the simple (no touch) version in the future.

 

NOTE that now I am looking into merging the two find (for future and distant past timestamps) into a single one as I believe there are logic operands in find command. Any help appreciated.

 

EDIT: Found error. -mtime 8500 checkes for exactly 8500 days back. I need to put +8500.

 

Edited by NLS

  • 4 years later...

Thanks for the detailed write up. I was able to fix my issue with the last command you have listed here. Quick question. I wanted to know how to change the date. What format is it using? Is that YYYYMMDD?? What are the last two digits? Can you clarify this?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.