cp

Solution to error 'find: missing argument to -exec' with find -exec cp {} TARGET_DIR + [closed]

霸气de小男生 提交于 2019-12-19 07:11:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I was getting ready to post this as a question, but after fiddling around with it a little longer, I found the solution. So I thought I would go ahead and post it here in case it helps someone else. I had trouble with find -exec cmd +. I got the error: $ find ./ -name "*JIM*" -exec cp {} $TARGET_DIR + find:

Solution to error 'find: missing argument to -exec' with find -exec cp {} TARGET_DIR + [closed]

倖福魔咒の 提交于 2019-12-19 07:11:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I was getting ready to post this as a question, but after fiddling around with it a little longer, I found the solution. So I thought I would go ahead and post it here in case it helps someone else. I had trouble with find -exec cmd +. I got the error: $ find ./ -name "*JIM*" -exec cp {} $TARGET_DIR + find:

动态清空 nohup 输出文件

人走茶凉 提交于 2019-12-18 09:46:56
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Linux下用nohup运行程序的, 输入或者日志会 默认写入nohup.out,一段时间以后, nohup.out 文件会越来越占空间,如果在程序运行过程中删除 nohup.out ,容易出错,有一种比较稳妥的解决办法: cat /dev/null > nohup.out 或者 cp /dev/null nohup.out 可以用上面的命令清空nohup.out文件,如果想保留原文件,可以先copy一份。 cp nohup.out nohup_bak.out 然后再清空 nohup.out 来源: oschina 链接: https://my.oschina.net/u/142179/blog/99061

Docker cp error: Path not specified

送分小仙女□ 提交于 2019-12-18 06:59:44
问题 I want to copy a file from my Ubuntu host to Docker container. I use Docker 1.6.2 from 14.04 LTS repository. When I try to copy I get error: sudo docker cp 1.JPG evil_sammet:/root/openface/training-images/misha/1.jpg FATA[0000] Error: Path not specified With equal success, I can type gibberish instead of file name and path: sudo docker cp sdfsdfasd dfsdffd FATA[0000] Error: Path not specified 回答1: Version 1.6.2 doesn't allow copying from host to container, you need to upgrade to at least 1.8

Linux how to copy but not overwrite?

余生长醉 提交于 2019-12-17 21:37:26
问题 I want to cp a directory but I do not want to overwrite any existing files even it they are older than the copied files. And I want to do it completely noninteractive as this will be a part of a Crontab Bash script. Any ideas? 回答1: Taken from the man page: -n, --no-clobber do not overwrite an existing file (overrides a previous -i option) Example: cp -n myoldfile.txt mycopiedfile.txt 回答2: Consider using rsync. rsync -a -v --ignore-existing src dst As per comments rsync -a -v src dst is not

Recursive copy of specific files in Unix/Linux? [closed]

痞子三分冷 提交于 2019-12-17 17:25:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I need to copy all *.jar files from directory and all its subdirectories. How can I do it in UNIX/Linux terminal? Command cp -r *.jar /destination_dir doesn't work. 回答1: rsync is useful for local file copying as well as between machines. This will do what you want: rsync -avm --include='*.jar' -f 'hide,! */' .

Copy files from one directory into an existing directory

送分小仙女□ 提交于 2019-12-17 17:20:32
问题 In bash I need to do this: take all files in a directory copy them into an existing directory How do I do this? I tried cp -r t1 t2 (both t1 and t2 are existing directories, t1 has files in it) but it created a directory called t1 inside t2, I don't want that, I need the files in t1 to go directly inside t2. How do I do this? 回答1: What you want is: cp -R t1/. t2/ The dot at the end tells it to copy the contents of the current directory, not the directory itself. This method also includes

Copying one file to another(Unix/C)?

这一生的挚爱 提交于 2019-12-14 04:12:05
问题 I have written the following code to copy one file to another. Although the code works, the code still prints both error messages. Why is this ? I am a complete beginner to Unix and C programming(although I have worked with C++ before), so any help in as much detail as possible would be great. Thanks ! int main(int argc, char *argv[]) { int n; char buf[4096]; while ((n=read( open(argv[1], O_RDONLY) , buf, 4096))>0) { if (write(creat(argv[2], S_IREAD | S_IWRITE ), buf, n)!=n) printf("Error

Explain me 2 lines of this shell script

梦想的初衷 提交于 2019-12-13 10:28:50
问题 What does this mean? if [ -f $2/$1 ] and this line: cp $1 $2/$1 Does $2/$1 represent a file, because it's associated with -f ? #!/bin/bash if test $# -ne 2 then echo "Numbers of argument invalid" else if [ -f $2/$1 ] then echo "file already exist , replace ?" read return if test $return = 'y' then cp $1 $2/$1 else exit fi else cp $1 $2/$1 fi fi 回答1: ./script.sh "tmp.txt" "/project" echo $1 = tmp.txt echo $2 = /project $1 - file name $2 - directory if [ -f $2/$1 ] - checks if file exists, -f

Rpmbuild copying folders specified by a mapping file

拥有回忆 提交于 2019-12-13 07:50:05
问题 Currently, working with rhel. Need to create a script that can use a mapping file (source and target need to be dynamic). What file type should be used for the mapping file (.csv, .txt, .json)? End directory in a slash e.g. src/ -r can be used against a file e.g. cp -r src/file.fil tgt/ script will be kicked off by the spec file and files will be copied during build source and target need to be dynamic Script example cp -r src/file.fil tgt/ Mapping file <src>\t<tgt>\n e.g. src/file.fil \t tgt