help! directories changed into regular files! :(

martijn martijn at pacno.net
Tue Dec 5 07:57:13 PST 2006


Hi,

I remembered thinking, should i backup the directory tree before this chang? nah ;-)

i used sed in a directory with subdirs, and it changed all directories into normal files :(

the exact command:

	sed -i -e s/'pm_properties\([^a-z]\)/#__properties\1/g' *

after which i discovered it had name the directories <name>-e and had turned
into regular files. no warnings whatsoever. (btw, yes i know that it should
have been -i.orig)

weird thing is, i can't reproduce the bug, and the command history wasn't big
enough to figure out what was so special about this particular situation... sed
sais 'in-place editing only works for regular files' but this time it didn't....

my question though: is there _any_ way to flip the bit that marks the file
being a directory? it would really be helpful to me because i've just lost a
lot of work.

any ideas?

bye
Martijn.


More information about the freebsd-questions mailing list