Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-09-2004, 04:15 AM   #1
Senior Member
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,294

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
2 .. 16 encapsulate.html
4 1st 16 faucet.html
20 COPYING 8 getpeername.html
4 FMT.COM 12 hose.html
4 FMT.TXT 1444
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 12 ssl-auth.html
4 common.h 4 timelimit.html
1 darius-admin-1.1 4
1 darius-misc-1.0 16
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
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
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 8 sockdown.html
4 common.h 12 ssl-auth.html
1 darius-admin-1.1 4 timelimit.html
1 darius-misc-1.0 4
1 darius-sound-1.1-3 16

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, 02:19 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 67
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" encapsulate.html ... other files ... 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, 02:45 PM   #3
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, 04:03 PM   #4
Senior Member
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,294

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.


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 01:01 PM
Executing commands and getting command results. xconspirisist Programming 2 03-11-2004 03:52 PM
Odd results from df command avantman42 Linux - General 0 11-17-2003 11:01 AM
Results from top command...user Q...? cbjhawks Linux - Software 1 09-20-2003 11:06 PM
Move file command? oldrelac Linux - Newbie 10 08-08-2003 12:58 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:50 PM.

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