LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-09-2004, 03:15 AM   #1
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
results of move command with *


i use the rename command constantly to organize files, and the mv command to rename directories. the format of the rename command is rename <from> <to> <which files>. the format of mv is <from> <to>.
so i accidently type mv in the rename format. i wouldn't have guessed what it did. i thought i had lost several days of downloaded files.

/work# d
total 2073
2 . 160 ebook.tar.bz
2 .. 16 encapsulate.html
4 1st 16 faucet.html
20 COPYING 8 getpeername.html
4 FMT.COM 12 hose.html
4 FMT.TXT 1444 libvorbis-aotuv_ex_20040402.zip
8 Makefile 1 luckroot
4 PRC2TXT.COM 4 memmove.h
4 PRC2TXT.TXT 256 net-tools-1.54-4.i386.rpm
8 README 28 pork.htm
4 aoTuV_test.txt 6 rute
4 bullfark 8 sockdown.html
4 check_videoconv.sh 12 ssl-auth.html
4 common.h 4 timelimit.html
1 darius-admin-1.1 4 uc_cdrl4.com
1 darius-misc-1.0 16 videoconv.sh
1 darius-sound-1.1-3 1 work
1 darius-text-1.1-2
/work# mv luckroot/ "Luckroot" *
mv: cannot stat `Luckroot': No such file or directory
mv: cannot stat `luckroot': No such file or directory
/work# ls
total 4
1 . 2 .. 2 work
/work# no no no no. can't be

it wasn't this directory i was working on, but another, with a bunch of files, and the work directory had hundreds of files in it. there were 400 megs in the main directory and 200 in the work directory which was still there. i didn't really know how much was in the work directory beforehand. after a few minutes of dejected looking around, i decided my total filesystem size seemed the same as before, so i went looking. everything was in the work directory.
normally i can just look at a badly typed command and know what it did, but this one eludes me.

/work# cd work
/work/work# ls
total 2071
2 . 1 darius-text-1.1-2
1 .. 160 ebook.tar.bz
4 1st 16 encapsulate.html
20 COPYING 16 faucet.html
4 FMT.COM 8 getpeername.html
4 FMT.TXT 12 hose.html
8 Makefile 1444 libvorbis-aotuv_ex_20040402.zip
4 PRC2TXT.COM 1 luckroot
4 PRC2TXT.TXT 4 memmove.h
8 README 256 net-tools-1.54-4.i386.rpm
4 aoTuV_test.txt 28 pork.htm
4 bullfark 6 rute
4 check_videoconv.sh 8 sockdown.html
4 common.h 12 ssl-auth.html
1 darius-admin-1.1 4 timelimit.html
1 darius-misc-1.0 4 uc_cdrl4.com
1 darius-sound-1.1-3 16 videoconv.sh
/work/work#

everything had been moved to the work directory from the command.
mv luckroot "Luckroot" *

i'm assuming because it was the last in alphabetical order. anyway, easy to move the stuff back, but i thought that was a weird result from that command.
 
Old 06-09-2004, 01:19 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
In th bash shell an * on it's own is replaced by the names of all the files and directories in the working directory in alphabetical order. Since you already had a directory called /work/work the mv command that you issued would have looked something like:
mv luckroot/ "Luckroot" ebook.tar.bz encapsulate.html ... other files ... videoconv.sh work

The last argument in the mv command must be a directory - in this case it was "work" (/work/work) and that is where your files were moved to.
 
Old 06-09-2004, 01:45 PM   #3
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Since this is not strictly a Success Story, moved to Linux-General
 
Old 06-09-2004, 03:03 PM   #4
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Original Poster
Rep: Reputation: 65
got it. i think what was throwing me the most was the message:
mv: cannot stat `Luckroot': No such file or directory
mv: cannot stat `luckroot': No such file or directory
but apparently, that was because "luckroot" was there twice, and "Luckroot" was there once, but Luckroot didn't exist.

i was thinking this was a success story at first,because i was so relieved to not have lost anything, then as i was typing it, i realized it wasn't.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot using FTP move command to move files adrianmak Linux - Networking 4 04-21-2009 12:01 PM
Executing commands and getting command results. xconspirisist Programming 2 03-11-2004 02:52 PM
Odd results from df command avantman42 Linux - General 0 11-17-2003 10:01 AM
Results from top command...user Q...? cbjhawks Linux - Software 1 09-20-2003 10:06 PM
Move file command? oldrelac Linux - Newbie 10 08-08-2003 11:58 AM

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

All times are GMT -5. The time now is 03:45 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