I have a group of folders (L1N-L5N), in which I want to copy from my /home/michael/documents/XXX to my Dropbox folder. At present, I have used the following script:
#!/bin/sh
cp -ra /home/michael/Documents/GeneralNetwork /GNI /home/michael/Dropbox/NetworkData
cp -ra /home/michael/Documents/GeneralNetwork /L1N /home/michael/Dropbox/NetworkData
cp -ra /home/michael/Documents/GeneralNetwork /L2N /home/michael/Dropbox/NetworkData
cp -ra /home/michael/Documents/GeneralNetwork /L3N /home/michael/Dropbox/NetworkData
cp -ra /home/michael/Documents/GeneralNetwork /L4N /home/michael/Dropbox/NetworkData
cp -ra /home/michael/Documents/GeneralNetwork /L5N /home/michael/Dropbox/NetworkData
This works, but poorly.
I am also unsure of the reasoning as to why it returns this:
cp: cannot stat ‘/GNI’: No such file or directory
cp: cannot stat ‘/L1N’: No such file or directory
cp: cannot stat ‘/L2N’: No such file or directory
cp: cannot stat ‘/L3N’: No such file or directory
cp: cannot stat ‘/L4N’: No such file or directory
cp: cannot stat ‘/L5N’: No such file or directory
I have thought of shortening it down:
cp -ra /home/michael/Documents/GeneralNetwork/L*
Or some other wildcard to pickup all folders containing "L". What I want is to copy the files (and overwrite) to the folder in this directory, however I cannot be certain they will fall under the above Folder Name Scheme.
What is the best way to create a .sh file to copy everythig from .../GeneralNetwork/* without copying hidden files etc? I have done the ../GeneralNetwork/. and it included boot, bin, sys etc.
"/home/michael/Documents/GeneralNetwork /GNI"
– blade19899 Oct 06 '14 at 08:27"GeneralNetwork "
with a space at the end? Why? Your problem with copying boot etc is probably that space; is that a typo? --- anyway, consider using tools like Unison for this kind of job --- see for example http://askubuntu.com/a/522423/16395 – Rmano Oct 06 '14 at 08:37