Skip to main content
edited tags; edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Tweeted twitter.com/#!/StackUnix/status/368661991130292224
deleted 49 characters in body
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

I have to copy a set of files from one folder to another folder and i amI'm using the following command,:

       `cpcp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files`files

the file contents in abc.txtabc.txt is like,:

./folder1/example.tar.gz ./folder2/example.tar.gz ./folder3/example.tar.gz

./folder1/example.tar.gz
./folder2/example.tar.gz
./folder3/example.tar.gz

But while executing the above 'cp' command am getting,

cp: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with cp./folder3 /example.tar.gz' cp command I'm getting: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with ./folder1/example.tar.gz'

cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder3 /example.tar.gz'
cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder1/example.tar.gz'

I can understand that because the name of the .gz files are the same itsthat are showing in the error.

what i What I want to do is,

to have the same folder structure inside "/home/tmp/test/files"/home/tmp/test/files as listed in abc.txt

likeabc.txt, like:

    /home/tmp/test/files/folder1/example.tar.gz
 
/home/tmp/test/files/folder2/example.tar.gz
 
/home/tmp/test/files/folder3/example.tar.gz

but amBut I'm getting only one 'example.tar.gz'insideexample.tar.gz inside files folder after executing the above "cp"cp command.

So what is the way to get what iI mentioned above?

Am new to this pls help me with explanation.

I have to copy set of files from one folder to another folder and i am using the following command,

       `cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files`

the file contents in abc.txt is like,

./folder1/example.tar.gz ./folder2/example.tar.gz ./folder3/example.tar.gz

But while executing the above 'cp' command am getting,

cp: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with ./folder3 /example.tar.gz' cp: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with ./folder1/example.tar.gz'

I can understand that because the name of the .gz files are same its showing the error.

what i want to do is,

to have the same folder structure inside "/home/tmp/test/files" as listed in abc.txt

like,

    /home/tmp/test/files/folder1/example.tar.gz
 
/home/tmp/test/files/folder2/example.tar.gz
 
/home/tmp/test/files/folder3/example.tar.gz

but am getting only one 'example.tar.gz'inside files folder after executing the above "cp" command.

So what is the way to get what i mentioned above?

Am new to this pls help me with explanation.

I have to copy a set of files from one folder to another folder and I'm using the following command:

cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files

the file contents in abc.txt is like:

./folder1/example.tar.gz
./folder2/example.tar.gz
./folder3/example.tar.gz

But while executing the above cp command I'm getting:

cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder3 /example.tar.gz'
cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder1/example.tar.gz'

I can understand that because the name of the .gz files are the same that are showing in the error. What I want to do is to have the same folder structure inside /home/tmp/test/files as listed in abc.txt, like:

/home/tmp/test/files/folder1/example.tar.gz
/home/tmp/test/files/folder2/example.tar.gz
/home/tmp/test/files/folder3/example.tar.gz

But I'm getting only one example.tar.gz inside files folder after executing the above cp command.

So what is the way to get what I mentioned above?

Source Link
Mano
  • 299
  • 2
  • 6
  • 13

copying files from one directory to another

I have to copy set of files from one folder to another folder and i am using the following command,

       `cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files`

the file contents in abc.txt is like,

./folder1/example.tar.gz ./folder2/example.tar.gz ./folder3/example.tar.gz

But while executing the above 'cp' command am getting,

cp: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with ./folder3 /example.tar.gz' cp: will not overwrite just-created /home/tmp/test/files/example.tar.gz' with ./folder1/example.tar.gz'

I can understand that because the name of the .gz files are same its showing the error.

what i want to do is,

to have the same folder structure inside "/home/tmp/test/files" as listed in abc.txt

like,

    /home/tmp/test/files/folder1/example.tar.gz

/home/tmp/test/files/folder2/example.tar.gz

/home/tmp/test/files/folder3/example.tar.gz

but am getting only one 'example.tar.gz'inside files folder after executing the above "cp" command.

So what is the way to get what i mentioned above?

Am new to this pls help me with explanation.