6
I'm trying to copy some files into existing folders. This is an example of the schema
# origin
/home/user/myfiles/folder1/group1/1.jpg
/home/user/myfiles/folder1/group1/2.jpg
/home/user/myfiles/folder1/group2/1.jpg
/home/user/myfiles/folder1/group2/2.jpg
/home/user/myfiles/folder2/group1/1.jpg
/home/user/myfiles/folder2/group1/2.jpg
/home/user/myfiles/folder2/group2/1.jpg
/home/user/myfiles/folder2/group2/2.jpg
The destination folder schema already exists, its just the origin files (jpgs) that are not there.
My question is how to do this?
I would like to end up with something like below, but this is not working. Maybe I should include regex in the query to separate asterisk into values and use as origin/destination?
cp /home/user/myfiles/*/*/*.jpg /home2/user/myfiles/*/*/*.jpg
My original intend is to use this copying schema on my unanswered question: s3cmd: how to copy files from local to S3 bucket with existing structure as a possible solution.
Are the destination folders completely empty? If so just delete them and copy files and directory structure. Also, the shell expansion of the second set of asterixes is your problem. – Hennes – 2012-07-25T23:34:51.037
They're not. They have other type of files that I still need. – Martin – 2012-07-25T23:42:39.397
Can you elaborate on your last sentence? – Martin – 2012-07-25T23:43:09.660
I can, but I am still trying to wrap my head around what your precise goal is. The cp command has the same source and destination. The s3cmd question identified local dev and remote s3 site, that I could understand. But the current question seems to be a NOP. (Granted, that might be because I am sleepy). – Hennes – 2012-07-26T00:04:23.277
@Hennes Sorry for misleading you, just fixed the question. The dest should be different than origin! – Martin – 2012-07-26T01:42:22.480