LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-17-2009, 06:24 PM   #1
hyphenated
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Rep: Reputation: 0
Please tell me what this command does


File operations, moving folders, I think I deleted everything.

current working directory is

Code:
/archive/personal# mv /archive/tmp/{dataA,dataB}* photos *
I meant to put the '&' at the very end of the statement but notice the '*' at the very end of the mv. Can you tell me something about this? Besides that I may be a complete moron.

In /archive/personal was the destination folder (photos) and about 7 other subdirectories

Thanks for your help.
 
Old 08-17-2009, 06:32 PM   #2
hyphenated
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Nevermind, too cautious. It just put them in the last directory in the cwd. GREAT!!
 
Old 08-18-2009, 04:44 AM   #3
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Hello hyphenated
I think you was not too cautious seeing the * character at the end of the command, especially under root login.
In Linux this character is rather powerful because it means 'everything accessible' in the present directory, and it is so replaced by all that is present in the current directory.
I think that it was not what you wanted with the command, if you wanted only to move some files in the photos directory (which you say was the destination directory of the mv command).
So you should not have used the * at the end, which can be dangerous if not your real choice.
I think it is more safer in this case to explicitly write the destination folder at the end, without using the * character.
Use it only if it is really necessary and cautiously.

Greetings.
 
Old 08-18-2009, 12:14 PM   #4
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
The command line is interpreted by bash unless the specific command supports regular expressions. At that point you need to quote them so that bash doesn't interpret them.

You should be able to do 'mv *' safely in any directory. If the out put of 'ls' does not output a directory last, then you will probably get the error "mv: target 'last file' is not a directory". If it is a directory, then all the files will go there.

You can do 'mv * anydir' and you will get the error "mv: cannot move 'anydir' to a sub-directory of itself, 'anydir/anydir' but all the other files and folders will go into anydir with no problem.

But anything that spits out warnings probably isn't a good command to be doing best not to be lazy about it.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM
Automatically append another piped command to issued command in bash amateen Programming 1 05-07-2009 06:36 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM
Translating windows pscp command to linux scp command help robward Linux - General 2 01-17-2008 06:02 AM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:25 PM.

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
Open Source Consulting | Domain Registration