Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
03-16-2015, 07:19 AM
#1
LQ Newbie
Registered: Mar 2015
Posts: 10
Rep:
Move a folder with all contents
hi
i need to move a directory from a subdomain to the root
the folder i need moved is in subdomains/magdev/public_html/images
and I need to move up to the root public_html of my hosting space, my structure looks like this
public_html
-images
subdomains
-magdev
--public_html
---images
So I need to move the bottom images directory to the top one
Can anyone help
Cheers
Last edited by paulgadsdon; 03-16-2015 at 07:44 AM .
03-16-2015, 07:51 AM
#2
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850
What have you tried? have you checked the command mv ?
03-16-2015, 07:54 AM
#3
Member
Registered: Oct 2011
Posts: 59
Rep:
sudo mv -R
03-16-2015, 07:54 AM
#4
LQ Newbie
Registered: Mar 2015
Posts: 10
Original Poster
Rep:
Yes, just cant quite get it
mv /images/* /../public_html/images*
Or something like this. i am in the directory
subdomains/magdev/public_html
Cheers
03-16-2015, 08:01 AM
#5
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850
sudo mv /full/path/to/images /full/path/to/new/location/images
1 members found this post helpful.
03-16-2015, 08:13 AM
#6
LQ Newbie
Registered: Mar 2015
Posts: 10
Original Poster
Rep:
Yes that makes sense, but does that move the images or the folders?
I have folders inside folders so need to recursive
I have to be careful here as I have 16000 images and 4.8GB
Thanks
Last edited by paulgadsdon; 03-16-2015 at 08:18 AM .
03-16-2015, 08:24 AM
#7
Member
Registered: Jul 2004
Location: Chennai, India
Posts: 952
I don't know why linux/unix users seem to be unwilling to try GUI solutions. Is it macho to try CLI without a clue?
Since nothing is mentioned about distinct users, I presume that you are in the correct login and having all rights. ie no user rights issues.
A simple drag and drop in your favourite (or default X system)should do it.
OK
Last edited by AnanthaP; 03-16-2015 at 08:34 AM .
03-16-2015, 08:53 AM
#8
LQ Newbie
Registered: Mar 2015
Posts: 10
Original Poster
Rep:
Quote:
Originally Posted by
AnanthaP
I don't know why linux/unix users seem to be unwilling to try GUI solutions. Is it macho to try CLI without a clue?
Since nothing is mentioned about distinct users, I presume that you are in the correct login and having all rights. ie no user rights issues.
A simple drag and drop in your favourite (or default X system)should do it.
OK
Oh please, i am working on a server, i only have shell access and I have never, ever seen a linux server with a GUI
03-16-2015, 08:59 AM
#9
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850
A directory is a container. Moving the directory will move (obviously) everything in it. What else can happen?
03-16-2015, 05:52 PM
#10
LQ Newbie
Registered: Feb 2011
Posts: 1
Rep:
cd into directory you moving.
cd subdomains/magdev/public_html/images
then do mv * /public_html/images
1 members found this post helpful.
03-16-2015, 07:14 PM
#11
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Quote:
Originally Posted by
paulgadsdon
I have to be careful here as I have 16000 images and 4.8GB
Try it on a small test directory first?
jlinkels
1 members found this post helpful.
03-17-2015, 06:14 AM
#12
LQ Newbie
Registered: Mar 2015
Posts: 10
Original Poster
Rep:
Quote:
Originally Posted by
Dopeamin
cd into directory you moving.
cd subdomains/magdev/public_html/images
then do mv * /public_html/images
I marked this as useful but this isnt going to work either as the subdomains directory is at the same level as the root
I need to go ip on level and copy the images folder and then go down two level sand paste
AHHHHHHHHHHHHHH
03-17-2015, 09:49 AM
#13
Member
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529
Quote:
Originally Posted by
paulgadsdon
I marked this as useful but this isnt going to work either as the subdomains directory is at the same level as the root
I need to go ip on level and copy the images folder and then go down two level sand paste
AHHHHHHHHHHHHHH
I am surprised this isn't solved already. Solutions have been posted.
Earlier you wrote "move," and
pan64 's solution would work fine:
Code:
sudo mv /full/path/to/images /full/path/to/new/location/images
It moves the directory and everything in it (including subdirectories and their contents).
In your latest post, you wrote "copy," and that is a little different. You could use cp -R:
Code:
cp -R /full/path/to/images /full/path/to/new/location/images
preceded by sudo if necessary. The -R means recursive.
Last edited by Beryllos; 03-17-2015 at 10:07 AM .
Reason: typo in second code section
03-17-2015, 10:02 AM
#14
Member
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529
Quote:
Originally Posted by
paulgadsdon
i need to move a directory from a subdomain to the root
the folder i need moved is in subdomains/magdev/public_html/images
and I need to move up to the root public_html of my hosting space, my structure looks like this
public_html
-images
subdomains
-magdev
--public_html
---images
So I need to move the bottom images directory to the top one
One more question: Does the images directory at the "root" level already exist? That complicates things.
03-17-2015, 05:55 PM
#15
Senior Member
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016
Quote:
Originally Posted by
jlinkels
Try it on a small test directory first?
jlinkels
This is absolutely what you should be doing! The question sounds to me as if you were messing with a production server. If you are not comfortable with the most basic commands like mv / cp you definitely want to run some dummy operations, ideally on another machine before doing the real move...
All times are GMT -5. The time now is 04:45 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News