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

Advertisement

hrvoj3e
Joined:
Posts:
6

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)

Reply with quote

Advertisement

hrvoj3e
Joined:
Posts:
6

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

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.

Reply with quote

Advertisement

You can post new topics in this forum