Moving files via command line on server in OC 9+

Please help us by providing the following info. Before posting please also check the pinned "Known issues" threads and make sure that you're running the latest available version for your oC release: https://owncloud.org/changelog/

Steps to reproduce
1. Upload File via web interface or mobile app
2. Verify file is available in app and web interface
3. Log into server and move file to new location via command line

Expected behaviour
In previous versions of owncloud I could manually move files via command line and find them in the new location. I use this to sort pictures and videos uploaded via mobile app. I know this is different in owncloud 9 but I need an automated way to move files. The instant upload folder becomes unmanageable for pictures and videos after many months. I had previously setup a cron job to create a new folder on the first of the month and subsequently move pictures and videos in the Instant Upload folder to the new folder. How can this be done now?

Actual behaviour
File still shown in previous location in web app and mobile app but not able to open, and file not seen in new location.

Server configuration
Operating system: Ubuntu 16.04.2
Web server: Apache2
Database: MySQL
PHP version: 7.0.15
ownCloud version (see ownCloud admin page): 9.1.4 (stable)
Updated from an older ownCloud or fresh install: Fresh install
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): no

ownCloud log (data/owncloud.log)

Please paste possible errors in the following code block, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808 for more info

{"reqId":"prWgqBWRJCRMB1iJ9Tli","remoteAddr":"24.217.35.240","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 503 Could not open file\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\ServiceUnavailable\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(83): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->get()\\n#1 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpGet(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(459): Sabre\\\\Event\\\\EventEmitter->emit('method:GET', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#5 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(57): Sabre\\\\DAV\\\\Server->exec()\\n#6 \\\/var\\\/www\\\/owncloud\\\/remote.php(164): require_once('\\\/var\\\/www\\\/ownclo...')\\n#7 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":306,\"User\":\"mrblue\"}","level":4,"time":"2017-03-28T13:16:04+00:00","method":"GET","url":"\/remote.php\/webdav\/Blending%20Priming%20Calculator.xlsx","user":"mrblue"}
{"reqId":"NXUc4gDSvPhnZh5lV9xw","remoteAddr":"68.114.34.42","app":"PHP","message":"fopen(\/storage\/owncloud\/ocdata\/\/mrblue\/files\/Blending Priming Calculator.xlsx): failed to open stream: No such file or directory at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#278","level":3,"time":"2017-03-28T13:19:23+00:00","method":"GET","url":"\/remote.php\/webdav\/Blending%20Priming%20Calculator.xlsx","user":"mrblue"}
{"reqId":"NXUc4gDSvPhnZh5lV9xw","remoteAddr":"68.114.34.42","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 503 Could not open file\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\ServiceUnavailable\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(83): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->get()\\n#1 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpGet(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(459): Sabre\\\\Event\\\\EventEmitter->emit('method:GET', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#5 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(57): Sabre\\\\DAV\\\\Server->exec()\\n#6 \\\/var\\\/www\\\/owncloud\\\/remote.php(164): require_once('\\\/var\\\/www\\\/ownclo...')\\n#7 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":306,\"User\":\"mrblue\"}","level":4,"time":"2017-03-28T13:19:23+00:00","method":"GET","url":"\/remote.php\/webdav\/Blending%20Priming%20Calculator.xlsx","user":"mrblue"}

Integrity status for oC9+

No errors have been found.

Hi,

manual modifications within the datadirectory where never supported. There is a FAQ available about this topic at [1] explaining the possible alternatives.

[1]

1 Like

These aren't new files. They were already uploaded via standard owncloud methods but I want to move them. This was supported because I have been using it since Owncloud 6.

Moving on command line is also nothing else then removing at one place and adding at another place.

Because something worked before doesn't mean it was supported. As written above manual modifications within the data directory was never supported, and that since the beginning of ownCloud.

What I am asking and looking for is a supported way to do this. Manually moving and then re-scanning files is laborious and shouldn't be the "supported method". This seems very hacky to me. Is there a way of doing this in the database without re-scanning all users data?

EDIT: The reason I say this is a "hacky solution" is that it takes hours to complete. I moved two files and issued the rescan command and it's still not completed two hours later.

Exactly because this is also not the "supported method" as you never should rely on the rescan of files.

The supported methods are already mentioned / listed in the linked FAQ above at "Alternatives".

My issue is not being addressed other than you saying "this is not supported". I do not want to use an external webdav client or an alternative method. I want to move files on my server if needed and have them populate correctly in the webclient and mobile app. Why is this not possible?

ALSO, I did read the alternative method which DID state to use the rescan command...where do you think I saw that?

Adding Files to External Storages
We recommend configuring the background job Webcron or Cron (see Defining Background Jobs) to enable ownCloud to automatically detect files added to your external storages.

ownCloud may not always be able to find out what has been changed remotely (files changed without going through ownCloud), especially when it’s very deep in the folder hierarchy of the external storage.

You might need to setup a cron job that runs sudo -u www-data php occ files:scan --all (or replace “–all” with the user name, see also Using the occ Command) to trigger a rescan of the user’s files periodically (for example every 15 minutes), which includes the mounted external storage.

Why are you claiming that your issue is not addressed? I have already pointed you twice to the resources containing the info about your issue and how to do this in a supported way.

To sum-up:

You need to use an alternative webdav client or such tools like dav2fs (both listed at the "Alternatives") as already advised to achieve what you're looking for. There is no other way around this.

Simple: Because you're not allowed to modify stuff within your datadir. Its just a fact, we don't need to continue here about the reasons (Please discuss this with the developers of ownCloud).

You might note that this is about "External storages" and the "External storage support app", not the data dir of ownCloud.

your response doesn't make any sense as to what I am asking. My data is local and not remote. The data is local to the server and is uploaded via the mobile client. If all you can provide is the same answer that I do not want to use, then stop replying..?

Bye. If you don't want to listen to the people telling you what you need to use to achieve what you're looking for then we don't need to continue here.

Edit

Just to have this documented:

Instead of doing this huge discussion here you could just have:

  1. open the command line on your server
  2. Type in cadaver https://example.com/remote.php/webdav
  3. Login with your credentials
  4. And finally move the file move oldname.txt newname.txt

A matter of a few seconds instead of 24 hours discussion here.