Results 1 to 2 of 2
This is stupid. I'm trying to recursively copy all files from one main directory to another.
Example:
directory1 contains:
a.txt
b/c.txt
b/d.txt
directory2 contains:
e.txt
b/f.txt
The end result for ...
- 05-28-2007 #1Just Joined!
- Join Date
- Dec 2004
- Location
- localhost
- Posts
- 56
Help with cp command!
This is stupid. I'm trying to recursively copy all files from one main directory to another.
Example:
directory1 contains:
a.txt
b/c.txt
b/d.txt
directory2 contains:
e.txt
b/f.txt
The end result for directory2 should be:
a.txt
e.txt
b/c.txt
b/d.txt
b/f.txt
Well, whatever I do with the cp command, it doesn't work. Here's my current script:
Edit: Okay, it works when it's NOT in a shell (ie, I manually input each command into the command-line). I'd like it to work in a shell script.Code:echo Copying /addons cp -rf mods/addons/* cstrike/addons/ echo Copying /cfg cp -rf mods/cfg/* cstrike/cfg/ echo Copying /materials cp -rf mods/materials/* cstrike/materials/ echo Copying /sound cp -rf mods/sound/* cstrike/sound/ echo ---------------- echo Done. echo ----------------
- 05-28-2007 #2
every shell script must have the following line at the top of the file:
You must also make the script executable: chmod +x YOURSCRIPTCode:#!/bin/bash
Hope that helps.Avatar from xkcd.com, a hilarious computer related webcomic.


Reply With Quote