LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2013, 03:50 PM   #1
Sasuke92
LQ Newbie
 
Registered: Dec 2013
Posts: 14

Rep: Reputation: Disabled
Unhappy Wildcard problem


Hey guys, I've been trying to figure this problem out for hours on end and still can't do it. Basically I have this question:

Ensuring you are in the same directory as the one containing the 5 files, copy these to the other directory. You must using a wildcard for the source of the copy. You must use a relative pathname involving the parent of the current directory to traverse to the destination of the copy.”

Basically, I created two folders using the mkdir command called Hello and Goodbye. Then I had to create 5 empty files in the Hello directory, so I created 5 files using the touch command ( Hello1, Hello2, Hello3, Hello4, Hello5).

Now this is the problem. I simply cannot get the wildcard to work to copy the files whilst I am INSIDE THE SAME DIRECTORY that I created them in. They only copy if I exit OUTSIDE of the Hello directory. As you can see, I am a newb lol am I missing something here? I keep getting “Goodbye is not a directory” and similar errors like that.

I have tried everything such as:

cp Hello/* Goodbye
cp Hello/Hello? Goodbye
cp Hello/Hello[1-5] Goodbye
cp Hello/[Hello]* Goodbye

All of these commands work if I am OUTSIDE of the Hello directory but they do not work if I am inside, and the question asks me to accomplish this from inside whilst using a wildcard, what am I doing wrong? I have also used “-r and -R” and yet, nothing.

Thanks for any replies.

Last edited by Sasuke92; 12-19-2013 at 04:10 PM.
 
Old 12-19-2013, 04:51 PM   #2
Spect73
Member
 
Registered: Aug 2013
Distribution: Slackware 14.1
Posts: 128

Rep: Reputation: Disabled
Try:
Code:
cd Hello
cp Hello? ../Goodbye
When you are in one directory, and want to go to another directory, you must specify the path. As your problem was wanting you to go relative to your currect directory you must use the "../" to go up one level.
 
1 members found this post helpful.
Old 12-19-2013, 05:47 PM   #3
Sasuke92
LQ Newbie
 
Registered: Dec 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Spect73 View Post
Try:
Code:
cd Hello
cp Hello? ../Goodbye
When you are in one directory, and want to go to another directory, you must specify the path. As your problem was wanting you to go relative to your currect directory you must use the "../" to go up one level.
Wow dude, thanks! That worked perfectly. Can't believe it, such small changes, man I feel stupid now.

I thought you also needed to include the name of the directory followed by the file, like (Hello/Hello1) etc but you don't seem to need that either. Learnt something new there.

I had to basically complete this exercise, http://bcu.copsewood.net/osint/pract..._revision.html
I did and completed 2,3,4,5,6 which is supposed to be a bit more challenging than the first question and yet I was struggling on the last part of the first question lol

Last edited by Sasuke92; 12-19-2013 at 06:00 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DNS problem with standard and wildcard record mlewis Linux - General 1 01-11-2013 02:03 PM
[SOLVED] wget wildcard problem bradvan Programming 8 11-07-2012 10:05 AM
Problem with wildcard SSL certificate b3rkl3y Linux - Server 0 05-26-2009 12:49 PM
dyndns wildcard enable problem noir911 Linux - Networking 1 04-15-2006 08:31 AM
cat sh script wildcard problem scm Programming 8 04-21-2004 06:19 AM


All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration