How to use cp -u on a Solaris system which does not support the -u option?
up vote
3
down vote
favorite
I want to copy only when the SOURCE file is newer than the destination file or when the destination file is missing. As you know, this feature will work on Linux system on following command.
cp -u /source/*.txt /destination/
but when i am using this command on solaris system 10. Below is my outut:
cp: illegal option -- u
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
Is there any solution?
solaris cp
|
show 1 more comment
up vote
3
down vote
favorite
I want to copy only when the SOURCE file is newer than the destination file or when the destination file is missing. As you know, this feature will work on Linux system on following command.
cp -u /source/*.txt /destination/
but when i am using this command on solaris system 10. Below is my outut:
cp: illegal option -- u
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
Is there any solution?
solaris cp
Don't think you can.
– 123
Jan 27 '16 at 9:47
is there any way out?
– Wasila
Jan 27 '16 at 9:48
If your shell supports theif [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you havepax
orrsync
available? That might be the easiest solution.
– Marco
Jan 27 '16 at 9:55
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37
|
show 1 more comment
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I want to copy only when the SOURCE file is newer than the destination file or when the destination file is missing. As you know, this feature will work on Linux system on following command.
cp -u /source/*.txt /destination/
but when i am using this command on solaris system 10. Below is my outut:
cp: illegal option -- u
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
Is there any solution?
solaris cp
I want to copy only when the SOURCE file is newer than the destination file or when the destination file is missing. As you know, this feature will work on Linux system on following command.
cp -u /source/*.txt /destination/
but when i am using this command on solaris system 10. Below is my outut:
cp: illegal option -- u
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
Is there any solution?
solaris cp
solaris cp
edited Nov 25 at 22:29
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked Jan 27 '16 at 9:41
Wasila
68118
68118
Don't think you can.
– 123
Jan 27 '16 at 9:47
is there any way out?
– Wasila
Jan 27 '16 at 9:48
If your shell supports theif [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you havepax
orrsync
available? That might be the easiest solution.
– Marco
Jan 27 '16 at 9:55
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37
|
show 1 more comment
Don't think you can.
– 123
Jan 27 '16 at 9:47
is there any way out?
– Wasila
Jan 27 '16 at 9:48
If your shell supports theif [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you havepax
orrsync
available? That might be the easiest solution.
– Marco
Jan 27 '16 at 9:55
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37
Don't think you can.
– 123
Jan 27 '16 at 9:47
Don't think you can.
– 123
Jan 27 '16 at 9:47
is there any way out?
– Wasila
Jan 27 '16 at 9:48
is there any way out?
– Wasila
Jan 27 '16 at 9:48
If your shell supports the
if [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you have pax
or rsync
available? That might be the easiest solution.– Marco
Jan 27 '16 at 9:55
If your shell supports the
if [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you have pax
or rsync
available? That might be the easiest solution.– Marco
Jan 27 '16 at 9:55
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37
|
show 1 more comment
3 Answers
3
active
oldest
votes
up vote
2
down vote
accepted
You might use rsync -u
which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13).
The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
add a comment |
up vote
3
down vote
cp -u
is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris.
On Solaris or any other POSIX-compliant system¹, you can use pax
, which has similar functionality. The pax
command is POSIX's replacement for the historical cpio
and tar
commands; in its pass-through mode, it's similar to cp -R
. The -u
option is similar to that of GNU cp
(they both took it from historical archivers such as tar
and ar
).
cd /source
pax -rw -u *.txt /destination
(Not pax -rw -u /source/*.txt /destination
, because that would create /destination/source/file.txt
)
¹ Beware that many Linux distributions omit pax from the default installation. It's always available as a package however.
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
add a comment |
up vote
0
down vote
You are on a rather old Solaris there. Anyways as others have pointed out the -u
option is something 'invented' in GNU, so you would have to use the GNU version of cp
. This is done by installing GNU coreutils and then explicitly referencing gcp
on your command line. Your example would become
gcp -u /source/*.txt /destination/
How this can be installed can be found here, but if your SysAdm had done his job it would have been there already (that's just my personal opinion :-))
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You might use rsync -u
which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13).
The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
add a comment |
up vote
2
down vote
accepted
You might use rsync -u
which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13).
The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You might use rsync -u
which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13).
The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).
You might use rsync -u
which provides the same functionality. It is available on the current Solaris release (11.x) and also in the last Solaris 10 one (Oracle Solaris 10 1/13).
The source code of the Solaris 10 one is included in the full open source code bundle downloadable from here (beware that it's a 1 GB file).
edited Jan 28 '16 at 1:27
answered Jan 27 '16 at 9:52
jlliagre
46.1k783132
46.1k783132
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
add a comment |
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
I am facing problem installing RSYNC Solaris 10. I have asked another question about the procedure. Subject line: RSYNC installation procedure on Solaris 10. any other solution rather than RSYNC/ CP -u?
– Wasila
Jan 27 '16 at 9:55
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Thanks jilliagre. I will let you know if your link solve my problem.
– Wasila
Jan 28 '16 at 3:05
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Beware recompiling is the hard way if you aren't familiar doing it. I would suggest you to consider Gilles' answer as it doesn't require any new software installation.
– jlliagre
Jan 28 '16 at 3:10
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
Ok sure jilliagre. I will go with Gilles solution.
– Wasila
Jan 28 '16 at 3:30
add a comment |
up vote
3
down vote
cp -u
is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris.
On Solaris or any other POSIX-compliant system¹, you can use pax
, which has similar functionality. The pax
command is POSIX's replacement for the historical cpio
and tar
commands; in its pass-through mode, it's similar to cp -R
. The -u
option is similar to that of GNU cp
(they both took it from historical archivers such as tar
and ar
).
cd /source
pax -rw -u *.txt /destination
(Not pax -rw -u /source/*.txt /destination
, because that would create /destination/source/file.txt
)
¹ Beware that many Linux distributions omit pax from the default installation. It's always available as a package however.
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
add a comment |
up vote
3
down vote
cp -u
is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris.
On Solaris or any other POSIX-compliant system¹, you can use pax
, which has similar functionality. The pax
command is POSIX's replacement for the historical cpio
and tar
commands; in its pass-through mode, it's similar to cp -R
. The -u
option is similar to that of GNU cp
(they both took it from historical archivers such as tar
and ar
).
cd /source
pax -rw -u *.txt /destination
(Not pax -rw -u /source/*.txt /destination
, because that would create /destination/source/file.txt
)
¹ Beware that many Linux distributions omit pax from the default installation. It's always available as a package however.
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
add a comment |
up vote
3
down vote
up vote
3
down vote
cp -u
is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris.
On Solaris or any other POSIX-compliant system¹, you can use pax
, which has similar functionality. The pax
command is POSIX's replacement for the historical cpio
and tar
commands; in its pass-through mode, it's similar to cp -R
. The -u
option is similar to that of GNU cp
(they both took it from historical archivers such as tar
and ar
).
cd /source
pax -rw -u *.txt /destination
(Not pax -rw -u /source/*.txt /destination
, because that would create /destination/source/file.txt
)
¹ Beware that many Linux distributions omit pax from the default installation. It's always available as a package however.
cp -u
is a feature of GNU coreutils, which is the standard on non-embedded Linux but not on Solaris.
On Solaris or any other POSIX-compliant system¹, you can use pax
, which has similar functionality. The pax
command is POSIX's replacement for the historical cpio
and tar
commands; in its pass-through mode, it's similar to cp -R
. The -u
option is similar to that of GNU cp
(they both took it from historical archivers such as tar
and ar
).
cd /source
pax -rw -u *.txt /destination
(Not pax -rw -u /source/*.txt /destination
, because that would create /destination/source/file.txt
)
¹ Beware that many Linux distributions omit pax from the default installation. It's always available as a package however.
edited Jan 28 '16 at 1:27
jlliagre
46.1k783132
46.1k783132
answered Jan 27 '16 at 23:42
Gilles
523k12610441576
523k12610441576
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
add a comment |
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
Thanks Gilles. It works. cd /source pax -rw -u *.txt /destination
– Wasila
Jan 28 '16 at 3:02
add a comment |
up vote
0
down vote
You are on a rather old Solaris there. Anyways as others have pointed out the -u
option is something 'invented' in GNU, so you would have to use the GNU version of cp
. This is done by installing GNU coreutils and then explicitly referencing gcp
on your command line. Your example would become
gcp -u /source/*.txt /destination/
How this can be installed can be found here, but if your SysAdm had done his job it would have been there already (that's just my personal opinion :-))
add a comment |
up vote
0
down vote
You are on a rather old Solaris there. Anyways as others have pointed out the -u
option is something 'invented' in GNU, so you would have to use the GNU version of cp
. This is done by installing GNU coreutils and then explicitly referencing gcp
on your command line. Your example would become
gcp -u /source/*.txt /destination/
How this can be installed can be found here, but if your SysAdm had done his job it would have been there already (that's just my personal opinion :-))
add a comment |
up vote
0
down vote
up vote
0
down vote
You are on a rather old Solaris there. Anyways as others have pointed out the -u
option is something 'invented' in GNU, so you would have to use the GNU version of cp
. This is done by installing GNU coreutils and then explicitly referencing gcp
on your command line. Your example would become
gcp -u /source/*.txt /destination/
How this can be installed can be found here, but if your SysAdm had done his job it would have been there already (that's just my personal opinion :-))
You are on a rather old Solaris there. Anyways as others have pointed out the -u
option is something 'invented' in GNU, so you would have to use the GNU version of cp
. This is done by installing GNU coreutils and then explicitly referencing gcp
on your command line. Your example would become
gcp -u /source/*.txt /destination/
How this can be installed can be found here, but if your SysAdm had done his job it would have been there already (that's just my personal opinion :-))
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Feb 20 '16 at 10:38
peterh
7191614
7191614
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f257957%2fhow-to-use-cp-u-on-a-solaris-system-which-does-not-support-the-u-option%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Don't think you can.
– 123
Jan 27 '16 at 9:47
is there any way out?
– Wasila
Jan 27 '16 at 9:48
If your shell supports the
if [ "$src" -nt "$dst ]; then …
construct you can use that one (however, not it's not in POSIX). Do you havepax
orrsync
available? That might be the easiest solution.– Marco
Jan 27 '16 at 9:55
I haven't tried pax yet. But I am unable to install rsync on my solaris system
– Wasila
Jan 27 '16 at 10:00
"cp" on Linux is usually from the GNU coreutils which are also available for Solaris - can you build & install software like that on your Solaris machine or are your privileges limited?
– alanc
Jan 27 '16 at 16:37