Web Hosting Talk







View Full Version : what happens if you mv /file , instead of mv /file . ?


hostito
06-29-2004, 10:19 AM
what happens if you mv /file , instead of mv /file . ?

I just did this with a file by mistake, and cannot seem to find it. I went to the root directory and ran this:

touch newfile.for.testing
mv newfile.for.testing ,

the file seems gone :(

info mv and man mv reveal nothing to the . or .. features that I use all the time.
I also tried this:

there is no file named "," in the original nor destination folder. Also, doing a locate , did not find anything there as to where it went...

Interestingly enough I do a locate for the old file name and see it where it was:

/backup/cpbackup/weekly/account_login/mysql
/backup/cpbackup/weekly/account_login/mysql/account_login_db1.sql
/backup/cpbackup/weekly/account_login/mysql/account_login_db2.sql
/backup/cpbackup/weekly/account_login/mysql/account_login.sql


When I go there, to /backup/cpbackup/weekly/account_login/ and do an ls, there is no mysql folder there :(

so somehow it seems to be in a sort of linux limbo...

Any ideas would be greatly appreciated :)

BigGorilla
06-29-2004, 10:28 AM
If you indeed typed "mv newfile.for.testing ," you should have a file named "," in the directory you were sitting in, probably the first thing that will show up in your directory listing.

An "ls -l /," should show it. If you still can't find it, try a "find / -name ," and see if it shows up.

hostito
06-29-2004, 10:38 AM
something must have gone wrong...

I did just verify through the history of my commands that I did mv to , my test just now shows the comma...

The strange thing is that locate still finds the old file, though it is not there, maybe locate has cached info or something...

Thanks for this, I will dig further to see what else I coudl have done...

hostito
06-29-2004, 10:42 AM
great, thanks you were right, locate is not live apparently, and the commas was not listing, good old find did the trick :)

BigGorilla
06-29-2004, 10:46 AM
locate only looks in the database created on the last updatedb run (which is typically once a day). See your /etc/cron.daily/slocate.cron file.

That's why locate is so much faster than find, as it's only searching an indexed database.

hostito
06-29-2004, 10:48 AM
Good one, I thought it was live, that is what threw me into momentary confusion. Must remember to drink coffee first :) Thanks again BigGorrilla!