Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
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.
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.
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.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Original Poster
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.