|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
cp, mv, and chown command options
I want to know, if it is possible to copy all files within one directory to another directory without copying the directory itself, and at the same time, change ownership of those files at their destination, all in one command?
For example: Lets say I want to copy all files within the /mnt/Documents directory to /home/user/Documents. When the files arrive at their destination, I want all of the permissions to have changed to the user and group I designate, but remain the same at their original location. I checked the man pages for cp and mv, but I did not see a way to accomplish the first part, that is, to copy all files within the directory without copying the directory itself. I think if this part can be accomplished, then the permissions can probably be changed as each file arrives at its destination. |
|
|||
Maybe instead of:
Code:
cp -R /mnt/Documents /home/user/Documents/ Code:
cp -R /mnt/Documents/* /home/user/Documents/ Code:
for VAR_ONE in `ls -1 /mnt/Documents/` ; do cp -R /mnt/Documents/${VAR_ONE} /home/user/Documents/ ; done ; Last edited by e1-531g; 23rd March 2016 at 09:16 PM. Reason: added third command with for loop |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PF and Stateful Tracking Options | mfaridi | OpenBSD Security | 9 | 15th April 2010 09:05 AM |
resetting make options? | carpman | FreeBSD Ports and Packages | 1 | 27th March 2010 12:54 PM |
Find command (Linux options?) | deadeyes | FreeBSD General | 11 | 23rd August 2009 06:07 PM |
How to get port's building options? | Sunsawe | FreeBSD Ports and Packages | 14 | 9th May 2009 06:35 PM |