Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I ran mv a-folder /home/me on a machine and half way through the move the destination device filled up.

a-folder was made up of folders and files in various subdirectories.

Does mv leave the source folder intact until the move has successfully completed?

The source and destination folders were on different filesystems.

The reason I ask is that I ran this command on the wrong machine, so if the source folder is intact then that makes my life a lot easier :)

share|improve this question

2 Answers 2

up vote 3 down vote accepted

No your source folder is not intact... On the same file system all mv does is add and remove directory entries. But on a different filesystem... I'm not sure at what point it unlinks the file, and whether it removes data as it goes... but once a file is moved, it is unlinked.

This is unless of course you used a special option to mv. Some of which are mentioned in this question which might interest you in the future.

share|improve this answer

xenoterracide's answer is 100% correct, I'll just add to it.

I often monitor the copy or move process of large amounts of files with:

watch -d -n 1 'du -sk dir1; du -sk dir2'

This will show you how the cumulated file size changes over time, proving to you that files are moved and removed (with mv) progressively along the way.

share|improve this answer
    
Thanks for that. Your username is strangely appropriate! ;) –  Rich Mar 3 '11 at 7:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.