Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Operators and Control Structures Logical Operators The Or (||) Operator

ANIKET KUWAR
ANIKET KUWAR
1,179 Points

Hi, What is the command to copy a file from one location to another ? I tried using cp (src, dst).

I want to move a file from one location to other. I am not able to do so using cp (src, dst). Can anyone please help with the proper command which would move file from one location to other?

Is this a Ruby related question?

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Are you trying to change the location of the file using the console?

1 Answer

Garrett Carver
Garrett Carver
14,681 Points

This is a general console question. Check out the treehouse course on this subject!

copy a file:

cp sourcefile destinationdirectory

move a file:

mv sourcefile destinationdirectory

rename a file:

mv sourcefile destinationfile

(essentially this copies the original file to the destination, wherever that may be, and removes the original)