Transferred documents from old NextCloudPi installation to new.. Modified Times not preserved

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2) : NextCloudPi v1.18
Operating system and version (eg, Ubuntu 20.04) : Raspbian Buster, Feb 2020. Linux raspberrypi 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux
Apache or nginx version (eg, Apache 2.4.25) : Server version: Apache/2.4.38 (Raspbian)
PHP version (eg, 7.1) : PHP 7.3.14-1~deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )

The issue you are facing:
I have two Raspberry Pis. An old version of NextCloudPi is installed on one Pi (v 0.54.7) and I have installed v1.18 on another Pi. I have transferred my documents from the old installation to the new. I copied the files from the ncp user folder in the datadir of one pi over to the other pi with the newer NextCloudPi installation. Then chmod’d everything to www-data then ran nc-fix-permissions and nc-scan.

Now the Modified Times of the FOLDERS in the “new” installation are not the same as on the “old” installation. They seem to have been re-created from when I ran nc-scan. The modified times for the FILES strangely were preserved as they were on the “old” NextCloudPi installation.

Those Modified Times that are displayed in the Web Interface to NextCloudPi… When transferring files and folders from one NextCloudPi installation to another is it possible to preserve the Modified Times that displays in NextCloudPi so they remain what they were on the “old” installation they were transferred from?

Cheers,

Flex

After spending a lot more hours on this, it seems to me that the behavior I am seeing is by design…

When you add a document to NextCloud the “Modified” column in the WebIf for the newly added file/folder becomes the date that file/folder was added. Likewise if a file is added to an existing folder the “Modified” time for that folder will update to the time the file was added to that folder.

If you want to preserve these “Modified” times that display in the NextCloud WebIf when trasnferring documents from one NextCloud installation to another it won’t be that easy! The best thing, I suspect, is to make a complete backup from the old NextCloud installation and restore this to the new one. But this may not be possible if the two versions are so different that they are incompatible. Or if you only want to transfer a few files/folders and keep documents in the new installation untouched.

You can change the “Modified” time that NextCloud gives to a file/folder in the WebIf by editing the NextCloud database. File and folder metadata is stored in the Nextcloud database. The timestamps for the “Modified” column are stored in the “mtime” column in the oc_filecache table.

This sql command will show the record for whatever file or folder it is you might want to change a timestamp for:

select fileid, name, path, FROM_UNIXTIME(mtime), FROM_UNIXTIME(storage_mtime) from oc_filecache where name = 'FOLDER_NAME>' limit 10;

Then you could run a command like this to update the mtime, to whatever you want it to be, for the record with the above fileid.
update oc_filecache set mtime = 1502658688 where fileid = 2222;

You need to work with unix timestamp which this website can generate for you from a human readable date/time.

To complicate things further, I found that running nc-scan from the nextcloudpi TUI re-sets the timestamps in the WebIf “Modified Time” column to the Modified Time the file or folder has in the Operating System… so better to get those right first… to do this I used Powershell from Windows.

Cheers,

Flex

1 Like

can we do something to suppress this by design feature & receive only OS based unix timestamp?? like sub-directory level get modified only upon any changes.