[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] OT: bash help - copying a series of files



Rob Owens wrote:

j.w. thomas wrote:
Rob Owens wrote:
I've read this somewhere before, but I'm having trouble finding it on
google...

I need to copy a series of files without using a loop.  I think the
syntax is something like: cp /path/to/[file1 file2] /destination/ folder

But that doesn't work. Does anybody know the correct syntax? Google
isn't so good at searching special characters like [ and {

I do this:
cp /path/to/file1 /path/to/file2 /destination/folder

If the names are as similar as you wrote though, you should be able to
do this:

cp /path/to/file[12] /destination/folder

The names really aren't that similar.  Here's the actual paths that I
need to copy:

/usr/local/share/icons/Drawings.desktop
/usr/local/share/icons/Obsolete\ Drawings.desktop
/usr/local/share/icons/Obsolete\ a\ Drawing.desktop

Since it's only 3 files, I could do as Robert suggests:

cp  /path/file1  /path/file2  /path/file3  /dest/dir

But I was hoping to find a way with less typing, just in case someday I
have to do this with 10 files instead of 3.

You could first change the current working directory, so you don't need to supply the path to every file.

	cd /usr/local/share/icons
cp Drawings.desktop Obsolete\ Drawings.desktop Obsolete\ a\ Drawing.desktop /dest/dir

Nils Breunese.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]