homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

Moving files one directory up
via SSH

 1:58 am on May 22, 2009 (gmt 0)


How do I move all files into one directory to another?

Example of what I need to do:

I have thousands of files in /home/accountname/public_html/directory/subdir/sub-subdir/

I need to move all the files contained in /sub-subdir/ into /home/accountname/public_html/directory/subdir/

Thank you,




 2:02 am on May 22, 2009 (gmt 0)

Do you want to physically move the files around on the server? If so, would you like to keep the same URL as before for each file so that users 'out on the web' do not see any changes?

Or are you wanting to throw away any "age" and "history" ranking benefits of those pages by giving them all a new URL too?

The first option needs a rewrite, but needs no changes to the site content.

The second option needs a redirect, and all the internal links on the pages also need to be amended.

[edited by: g1smd at 2:11 am (utc) on May 22, 2009]


 2:05 am on May 22, 2009 (gmt 0)

Yes I want the files physically moved on the server. I've made changes to the CMS so once I move them to the desired directory users won't notice the change.

Thank you for your response,



 2:12 am on May 22, 2009 (gmt 0)

If so, would you like to keep the same URL as before for each file so that users 'out on the web' do not see any changes?

That is, if you use a rewrite, users will continue to use the same URLs as before, and the rewrite will fetch the content from the new server location without revealing that new location to the user.


 2:22 am on May 22, 2009 (gmt 0)


The files are all video files.

I need to move them up one directory so users on the web can play them when they go to the site.

I don't need to do any redirects for the video files because I already told the CMS to look in the new directory (where I want to move them) to play them.

Thank you,



 2:33 am on May 22, 2009 (gmt 0)

You are overlooking several things.

Other user agents that have references to the old URLs stored in memory, and users with bookmarks, will now get "404 Not Found" if you have given the videos new URLs and you do not redirect requests for the old URLs.

However more important than that, is that just because you have moved stuff around inside the server, doesn't mean that the files now have to have new URLs. Using a rewrite (that's a rewrite, not a redirect) you can continue to use the old URLs while having the files stored someplace else inside the server.

This gets overlooked very often, and there's several threads on this topic in the Apache forum in the last couple of days, and hundreds more over the last few years.


 2:38 am on May 22, 2009 (gmt 0)


The videos will have different URLs but the CMS will take care of pulling them from the new URLs to play in the video player.

If users will still get the 404 error instead of moving the files how can I copy them so they're in both directories.

Thank you,



 2:48 am on May 22, 2009 (gmt 0)

The URLs to the video pages will still be the same.

For example. I have /home/accountname/public_html/directory/subdir/sub-subdir/video123.flv The URL web users use to access this video is www.mysite.com/video123.html for example.

Web users will still have to go to www.mysite.com/video123.html to access the video but the video will be in /home/accountname/public_html/directory/subdir/video123.flv

Hope that clears it up.



 8:54 am on May 22, 2009 (gmt 0)

to move:

cd /home/accountname/public_html/directory/subdir/sub-subdir/
mv * ../

to copy:

cd /home/accountname/public_html/directory/subdir/sub-subdir/
cp -R * ../


 8:58 am on May 22, 2009 (gmt 0)


Thank you for your help.



 7:51 pm on May 22, 2009 (gmt 0)

*** how can I copy them so they're in both directories ***

You absolutely do NOT want to do that. That's a Duplicate Content issue.

OK, so now you have physically moved all your files around on the server, can I somehow get through to you that you do have to make users see new URLs for those files?


 7:59 pm on May 22, 2009 (gmt 0)


I thank you for your response. I have already taken care of the fact that users need to see the files in new URLs. I have setup a 301 redirect for all the files.

The files have been moved and only in one directory so there will be no issue with duplicate content.

The users see the files perfectly now, no 404's and no duplicate content.

Thank you,



 4:49 pm on May 23, 2009 (gmt 0)

Just an aside, in respect to duplicate content and 301 redirects/SEO, etc., .flv files are not indexed by search engines, are they? (Not to my knowledge.) They need to be imported into Flash, and hence are not indexed (without some special things in Flash to expose them to the SE's.) So in the case of the .flv's themselves, moving around shouldn't cause problems. (?)


 6:42 pm on May 23, 2009 (gmt 0)

There was supposed to be a NOT in my question -- just because files have moved, you do NOT have to have new URLs for those files.


 7:33 pm on May 23, 2009 (gmt 0)


Yes I think you're right about SEs not indexing .flvs.

This is what's up:

I was using a CMS that had URLs like this www.example.com/name-of-video-11.html for example, 11 being the video ID that's stored in the database.

I changed CMSs to where the new URLs are www.example.com/11/name-of-video.html. I properly set up a 301 redirect from the old URLs to the new.

What I needed to do was move the video files to the directories where the new CMS looks for them when a user requests www.example.com/11/name-of-video.html

Even if I had the video files in both directories at the same time wouldn't cause duplicate content because like you said SEs don't index .flv files, unless you link to them directly on a page I believe.


I understood what you were saying, but I don't think you understood what I was originally saying. Everything's good now. The files are moved and the new CMS is working and nobody's getting 404's. Thanks for your help people.


[edited by: phranque at 7:08 am (utc) on May 24, 2009]
[edit reason] exemplified urls [/edit]

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved