Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2006
    Posts
    516

    How do I Move Files & Subdir (without changing Chown & Chmod)

    As title:
    How do I Move Files & Sub directory without changing Chown & Chmod them?

    Situation:

    I need to move /home/user/public_html/blog (all files & subdir) into /home/user/public_html

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,202
    Are you moving between accounts?

    or just moving everything back to public_html?

    You don't move files via chown & chmod. ( chown - change ownership chmod - change permissions )

    You can move files via command mv or copy the files via cp.

    I hope this helps, you haven't explained much

    Best Regards,
    SSANZ
    DigitalGoods.info
    FREE Shared, Mega Resellers + Dedicated Servers

  3. #3
    Join Date
    Apr 2006
    Posts
    516
    As said, I need to move /home/user/public_html/blog (all files & subdir) into /home/user/public_html

    I'm not sure mv is the correct command. It would rename instead.

    /blog/subfolder1
    /blog/subfolder2
    /blog/subfolder3
    /blog/subfolder4
    /blog/dozens of files here

    I can use cp for the files

    If I use mv I need to do it one by one (for subfolders), and then it will change ownership to root:root and permission to default permission, some folders are 777

    How do I do it the correct way?

  4. #4
    Join Date
    Mar 2008
    Posts
    47
    mv won't change permissions and ownership for your folders. You don't need to copy folders and files one by one. You can use the -i option and it will ask you before overwriting the files and folders.

    cd /home/user/public_html/blog/;
    mv -i * ../;

    You can also use cp if you want to copy files from /home/user/public_html/blog to /home/user/public_html with the option -a so that permissions and ownership would not be changed.

    cd /home/user/public_html/blog/;
    cp -a * ../;
    GlowHost.com - Your fully managed, dedicated server specialists.
    >> FFmpeg Web Hosting - Video Sharing and Social Networking web sites
    >>> SHOUTcast Servers - 128k - Unlimited Users - Radio Control Panel
    >>>> 99.9% Uptime Guarantee - 60 day risk free money back - 24/7/365 Support

  5. #5
    you can even move by using VZPP panel.

  6. #6
    just type the below

    mv /home/user/public_html/blog/* /home/user/public_html

    this will move everything from blog to public_html
    Web Hosting Gurus

  7. #7
    Join Date
    Mar 2008
    Posts
    83
    mv can be used to MOVE files and to RENAME files. depending on the commands you type.
    <- myusername dot com is not a link to sites or images containing pornography, sexually explicit, gross violence, warez etc.

  8. #8
    Join Date
    Apr 2006
    Posts
    516
    Quote Originally Posted by spal911 View Post
    mv won't change permissions and ownership for your folders. You don't need to copy folders and files one by one. You can use the -i option and it will ask you before overwriting the files and folders.

    cd /home/user/public_html/blog/;
    mv -i * ../;

    You can also use cp if you want to copy files from /home/user/public_html/blog to /home/user/public_html with the option -a so that permissions and ownership would not be changed.

    cd /home/user/public_html/blog/;
    cp -a * ../;
    Thanks. That works!

    [closing]

  9. #9
    Join Date
    Mar 2008
    Posts
    47
    Quote Originally Posted by hbhb View Post
    Thanks. That works!

    [closing]
    No problem.
    GlowHost.com - Your fully managed, dedicated server specialists.
    >> FFmpeg Web Hosting - Video Sharing and Social Networking web sites
    >>> SHOUTcast Servers - 128k - Unlimited Users - Radio Control Panel
    >>>> 99.9% Uptime Guarantee - 60 day risk free money back - 24/7/365 Support

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •