When you upload a file to a course it get assigned a hashvalue and stored in the /moodledata/filedir directory

To find out where, search the moodle database for the filename:

SELECT contenthash FROM mdl_files WHERE filename = ‘myfile.doc’;

This will return something like fb9d09535c7fce57abaa6f8a264137c39bea923b

Navigate to your moodledata/filedir and search for the hash:

find . -name fb9d09535c7fce57abaa6f8a264137c39bea923b

Take a copy, restoring the original name:

cp fb9d09535c7fce57abaa6f8a264137c39bea923b myfile.doc