Copy files located on a FTP, from a collection to local drive with same structure

Hi,

I copied a lot of files from a FTP and I got some errors, which I exported into a collection.
I then thought I could simply copy the members from the collection to the destination lister and keep the structure.
I was expecting Directory Opus to show me a copy dialog asking me to recreate the folders, but if I copy the files from the collection, it just copy all of them flat in the current folder, without recreating any of the source folders.

I looked and found the following script which seems to help a lot and do the job:

It copies the structure, but the only issue, is it adds extra root folders with the FTP name.

Example:
I'm in "D:\Temp\backup"
I copy the following file which is member of a collection:
ftp://ftp.server.com//www/wp-content/uploads/index.php

It copies it to:
D:\Temp\backup\ftp\ftp.server.com\www\wp-content\uploads\index.php
I would have expected:
D:\Temp\backup\www\wp-content\uploads\index.php

I'm sure the script can be enhanced, but I wanted to know if there was a simpler way to do it without any script ? Shouldn't Directory Opus be able to handle this directly ?

FTR, I tried simple buttons like:
@nofilenamequoting
Copy CREATEFOLDER="{destpath}{filepath$|..|noterm|noroot}"

but it creates a strange folder structure :
D:\Temp\Backup\Users\UserName\AppData\Local\Temp\dtemp-cb2fba70-1808978468-20.dop\index.php

Thank you for your help :slight_smile:

There's no automatic way for Opus to guess which parts of the path you do/don't want.

If you don't want to modify the script to remove the unwanted parts, an easy alternative is to move everything after the copy, which shouldn't take more than a couple of seconds to do.

Hi Leo,

I understand this, but the protocol and the server address are not really useful when you try to replicate a folder structure from 1 place to another, keeping the ftp\servername.com is not helpful.

Without talking about the guessing of the path, is there a way for Directory Opus to recreate the folder structure without using an external script ?

I reckon the following should have handled the recreate structure without the protocol and the servername:
Copy CREATEFOLDER="{destpath}{filepath$|..|noterm|noroot}"

However it doesn't work properly for FTP apparently as I end up with the following path:
D:\Temp\Backup\Users\UserName\AppData\Local\Temp\dtemp-cb2fba70-1808978468-20.dop\index.php

Cheers

Maybe not to you, but it is sometimes. You might be backing up multiple sites.

It wouldn't be an external script; it'd be some script code in a button that uses Opus's scripting objects.

Doing it via the Evaluator is another option, since you could apply a regex to the path.

Edit: Just remembered you can also apply regex to paths in normal commands. See Codes for passing paths [Directory Opus Manual]

thank you for the pointers, I'll try my luck.
What about the strange path that DO creates when I use this command ?
Copy CREATEFOLDER="{destpath}{filepath$|..|noterm|noroot}"

Shouldn't it work as expected ? Without the need to use scripts.

See @nolocalizefiles: Command modifier reference [Directory Opus Manual]

THIS is PERFECT !

no script, no pain, working out of the box, great !

Thank you Leo, you are da man !

FTR, I use this on the collection members:

@nofilenamequoting
@nolocalizefiles
Copy CREATEFOLDER="{destpath}{filepath$|..|noterm|noroot}"