Mostly Linux & Python syntax notes and hyperlinks.

Tuesday, March 27, 2012

Linux: moving a directory into itself

I didn't know you could do this.

OK, I had a directory with code that I was changing, and I had a bak/ directory in which I was saving current versions.

I had a some files with the string "bak" in them.  I tried to move *bak into bak and lost the entire directory.

Yeah, it was late in the day.

[fire@ice frost]$ mv _* bak
`_some.cmd' -> `bak/_some.cmd'
[fire@ice frost]$ mv say_bak.cmd bak
`say_bak.cmd' -> `bak/say_bak.cmd'
[fire@ice frost]$mv *bak bak
`bak' -> `bak/bak'
`the_world.cmd.bak' -> `bak/the_world.cmd.bak'
mv: cannot move `the_world.cmd.bak' to `bak/the_world.cmd.bak': No such file or directory

No comments:

Post a Comment