Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

hrvoj3e wrote:

How can I get the same behaviour as the native Duplicate (Shift+F5) command?
I want to auto populate the target path with the current selected file path.

That's not possible.

Another way is to alias the cp to drop the -p switch (some shell script would be required for that).

Btw. how to make it work with preserving timestamps in debian/ubuntu?
Do I need to use ACL for file permissions? We use WinSCP a lot and multiple users edit the same files

I do not have any experience with *nix ACLs.
hrvoj3e

How can I get the same behaviour as the native Duplicate (Shift+F5) command?
I want to auto populate the target path with the current selected file path.

cp -r -f "!" "!?Target remote path?!!"

! Any File path (a relative path to a root of an operation, when referring to remote file; an absolute path when referring to a local temporary copy of a remote file). Command with the pattern will be executed once for every selected file. In general it should be surrounded with quotes for the command to work with filenames containing spaces. Cannot be combined with pattern !&.

!?prompt[\]?default! Any When used, user is prompted to enter value that replaces the pattern. prompt can define a message of the prompt and default a default value, both can be empty. Special characters entered by user are automatically delimited. You can prohibit this using optional backslash (\) before second question mark (?).


Btw. how to make it work with preserving timestamps in debian/ubuntu?
Do I need to use ACL for file permissions? We use WinSCP a lot and multiple users edit the same files
martin

Re: Duplicating files - cp: preserving times for - Operation not permitted

To preserve timestamp (-p), you actually need to be a (target) file owner.

As a workaround, you can setup a custom command without the -p:
cp -r -f "!" "!?Target remote path?!"
https://winscp.net/eng/docs/custom_command
hrvoj3e

Duplicating files - cp: preserving times for - Operation not permitted

Files have the same group and group has write permissions but I always get this error:

Command 'cp -p -r -f "SomeFile.php" "/target/path/to/file/SomeFile.php"'
failed with return code 1 and error message
cp: preserving times for '/target/path/to/file/SomeFile.php': Operation not permitted.

Current dir : "/source/path/to/file/SomeFile.php"
Duplicate to : "/target/path/to/file/SomeFile.php"

Stat info for both files:
  File: "/source/path/to/file/SomeFile.php"

  Size: 39981           Blocks: 80         IO Block: 4096   regular file
Device: fc01h/64513d    Inode: 659763      Links: 1
Access: (0775/-rwxrwxr-x)  Uid: ( 1003/userA)   Gid: ( 1001/ group1)

  File: "/source/path/to/file/SomeFile.php"
  Size: 39981           Blocks: 80         IO Block: 4096   regular file
Device: fc01h/64513d    Inode: 2632005     Links: 1
Access: (0775/-rwxrwxr-x)  Uid: ( 1001/ userB)   Gid: ( 1001/ group1)