cp

How do I copy folder with files to another folder in Unix/Linux? [closed]

我的梦境 提交于 2019-11-30 10:02:03
问题 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 am having some issues to copy a folder with files in that folder into another folder. Command cp -r doesn't copy files in the folder. 回答1: The option you're looking for is -R . cp -R path_to_source path_to_destination/ If destination doesn't exist, it will be created. -R means copy directories recursively .

How to resolve /var/www copy/write permission denied?

不问归期 提交于 2019-11-30 04:48:42
I am a newbie in php, mysql. I have written a hello.php script, which I am trying to copy into /var/www directory (and will later want to open it through web browser). The problem with the same is that I am not allowed to save/write any files in /var/www despite me being the root. I tried implementing steps in this question, but I get the following error when I process the third line find /var/www/ -type f -exec chmod g+w '{}' ';' chmod: changing permissions of `/var/www/index.html': Operation not permitted I know symlink is also an option. I would want to be able to write/copy files directly

Shell Scripting unwanted '?' character at the end of file name

孤人 提交于 2019-11-30 04:15:35
问题 I get an unwanted '?' at the end of my file name while doing this: emplid=$(grep -a "Student ID" "$i".txt | sed 's/(Student ID: //g' | sed 's/)Tj//g' ) #gets emplid by doing a grep from some text file echo "$emplid" #prints employee id correctly cp "$i" "$emplid".pdf #getting an extra '?' character after emplid and before .pdf i.e instead of getting the file name like 123456.pdf , I get 123456?.pdf . Why is this happening if the echo prints correctly? How can I remove trailing question mark

pass output as an argument for cp in bash [duplicate]

ε祈祈猫儿з 提交于 2019-11-30 01:26:21
This question already has an answer here: How to pass command output as multiple arguments to another command 4 answers I'm taking a unix/linux class and we have yet to learn variables or functions. We just learned some basic utilities like the flag and pipeline, output and append to file. On the lab assignment he wants us to find the largest files and copy them to a directory. I can get the 5 largest files but I don't know how to pass them into cp in one command ls -SF | grep -v / | head -5 | cp ? Directory It would be: cp `ls -SF | grep -v / | head -5` Directory assuming that the pipeline is

省对应的市区经纬度信息

邮差的信 提交于 2019-11-30 01:11:08
ProvinceCityList = [{ 'name': '上海市', 'child': [ { 'name': '奉贤区', 'cp': [121.458472, 30.912345] }, { 'name': '崇明区', 'cp': [121.397516, 31.626946] }, { 'name': '浦东新区', 'cp': [121.567706, 31.245944] }, { 'name': '金山区', 'cp': [121.330736, 30.724697] }, { 'name': '嘉定区', 'cp': [121.250333, 31.383524] }, { 'name': '宝山区', 'cp': [121.489934, 31.398896] }, { 'name': '黄浦区', 'cp': [121.490317, 31.222771] }, { 'name': '杨浦区', 'cp': [121.522797, 31.270755] }, { 'name': '普陀区', 'cp': [121.392499, 31.241701] }, { 'name': '长宁区', 'cp': [121.4222, 31.218123] }, { 'name': '松江区', 'cp': [121.223543, 31.03047] }, {

How to copy multiple files from a different directory using cp?

大兔子大兔子 提交于 2019-11-29 21:15:17
I want to copy multiple files from a specific directory once I am in another directory. To clarify I want to do the following, at once (one command): cp ../dir5/dir4/dir3/dir2/file1 . cp ../dir5/dir4/dir3/dir2/file2 . cp ../dir5/dir4/dir3/dir2/file3 . cp ../dir5/dir4/dir3/dir2/file4 . I can't use cp ../dir5/dir4/dir3/dir2/* . because in dir2 there are n files (n>4) By the way, I'm using bash . Thanks. cp ../dir5/dir4/dir3/dir2/file[1234] . or (in Bash) cp ../dir5/dir4/dir3/dir2/file{1..4} . If the file names are non-contiguous, you can use cp ../dir5/dir4/dir3/dir2/{march,april,may} . If all

How to force 'cp' to overwrite directory instead of creating another one inside?

丶灬走出姿态 提交于 2019-11-29 20:05:48
I'm trying to write a Bash script that will overwrite an existing directory. I have a directory foo/ and I am trying to overwrite bar/ with it. But when I do this: cp -Rf foo/ bar/ a new bar/foo/ directory is created. I don't want that. There are two files in foo/ ; a and b . There are files with same names in bar/ as well. I want the foo/a and foo/b to replace bar/a and bar/b . You can do this using -T option in cp . See Man page for cp . -T, --no-target-directory treat DEST as a normal file So as per your example, following is the file structure. $ tree test test |-- bar | |-- a | `-- b `--

How do I copy folder with files to another folder in Unix/Linux? [closed]

不羁岁月 提交于 2019-11-29 18:31:01
I am having some issues to copy a folder with files in that folder into another folder. Command cp -r doesn't copy files in the folder. Pierre Salagnac The option you're looking for is -R . cp -R path_to_source path_to_destination/ If destination doesn't exist, it will be created. -R means copy directories recursively . You can also use -r since it's case-insensitive. Note the nuances with adding the trailing / as per @muni764's comment . Alex W You are looking for the cp command. You need to change directories so that you are outside of the directory you are trying to copy. If the directory

Docker cp error: Path not specified

喜夏-厌秋 提交于 2019-11-29 11:40:05
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 Version 1.6.2 doesn't allow copying from host to container, you need to upgrade to at least 1.8 for that support. 来源: https://stackoverflow.com/questions/39397831/docker-cp-error-path-not-specified

pass output as an argument for cp in bash [duplicate]

て烟熏妆下的殇ゞ 提交于 2019-11-28 20:54:07
问题 This question already has answers here : How to pass command output as multiple arguments to another command (4 answers) Closed 3 years ago . I'm taking a unix/linux class and we have yet to learn variables or functions. We just learned some basic utilities like the flag and pipeline, output and append to file. On the lab assignment he wants us to find the largest files and copy them to a directory. I can get the 5 largest files but I don't know how to pass them into cp in one command ls -SF