Skip to main content
edited body
Source Link
Volker Siegel
  • 17.7k
  • 6
  • 56
  • 81

You are expanding the DESTINATION variable, if you did echo this is what you would get:

echo ${DESTINATION}
/home/hogar/Ubuntu\ One/folder

But mv doesn't understand this:

mv ${FILE} ${DESTINATION}                                                
mv: cannot move '/home/hogar/Documents/files/bdd.encrypted’encrypted' to '/home/hogar/Ubuntu\\ One/folder’folder': No such file or directory

(for some reason my mv is more verbose)

To prevent this you should use quotes instead:

mv "${FILE}" "${DESTINATION}"

If you don't need expansion (since you are already expanding before) just using "$..." should suffice:

mv "$FILE" "$DESTINATION"

You are expanding the DESTINATION variable, if you did echo this is what you would get:

echo ${DESTINATION}
/home/hogar/Ubuntu\ One/folder

But mv doesn't understand this:

mv ${FILE} ${DESTINATION}                                                
mv: cannot move /home/hogar/Documents/files/bdd.encrypted’ to /home/hogar/Ubuntu\\ One/folder’: No such file or directory

(for some reason my mv is more verbose)

To prevent this you should use quotes instead:

mv "${FILE}" "${DESTINATION}"

If you don't need expansion (since you are already expanding before) just using "$..." should suffice:

mv "$FILE" "$DESTINATION"

You are expanding the DESTINATION variable, if you did echo this is what you would get:

echo ${DESTINATION}
/home/hogar/Ubuntu\ One/folder

But mv doesn't understand this:

mv ${FILE} ${DESTINATION}                                                
mv: cannot move '/home/hogar/Documents/files/bdd.encrypted' to '/home/hogar/Ubuntu\\ One/folder': No such file or directory

(for some reason my mv is more verbose)

To prevent this you should use quotes instead:

mv "${FILE}" "${DESTINATION}"

If you don't need expansion (since you are already expanding before) just using "$..." should suffice:

mv "$FILE" "$DESTINATION"
Source Link
Braiam
  • 36.9k
  • 29
  • 114
  • 176

You are expanding the DESTINATION variable, if you did echo this is what you would get:

echo ${DESTINATION}
/home/hogar/Ubuntu\ One/folder

But mv doesn't understand this:

mv ${FILE} ${DESTINATION}                                                
mv: cannot move ‘/home/hogar/Documents/files/bdd.encrypted’ to ‘/home/hogar/Ubuntu\\ One/folder’: No such file or directory

(for some reason my mv is more verbose)

To prevent this you should use quotes instead:

mv "${FILE}" "${DESTINATION}"

If you don't need expansion (since you are already expanding before) just using "$..." should suffice:

mv "$FILE" "$DESTINATION"