Mv: cannot remove directory: Directory not empty

directorymv

Running the command

/data/jritchie$ mv ~/jenkins_dev /data/jritchie/jenkins_dev

I'm getting a bunch of errors like the following:

mv: cannot remove `/home/jritchie/jenkins_dev/plugins/valgrind/WEB-INF/lib': Directory not empty

This is similar to errors returned by rm.

My question is, does this error mean that my files were all successfully moved to the new location, but removing them from the old location failed? Or that they didn't get moved at all? Can I safely remove the old files with rm -r ~/jenkins_dev?

Best Answer

Check to see if there is a file/folder in there that you don't own. Assuming bash and all file names are nicely behaved, something like:

for file in $(find ~/jenkins_dev); do stat -c '%U %n' $file;done | grep -v jritchie

If something pops up then you need to get the owner (or sysadmin) to handle it for you.