LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 04-29-2011, 03:25 PM   #1
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 249

Rep: Reputation: 1
move files between file systems


Hi

I have to move files between two file systems /inst and /inst2.
When I perform 'cp -a /inst /inst2' it copies everything even hidden files and preserves access permissions.

But when I perform 'mv /inst /inst2' it also preserves access perms and moves everything besides hidden files.

Questions :
------------
Why is so ?
What tool to use when moving file systems from one fs to another (rsync) ?

thx for help.
 
Old 04-29-2011, 03:58 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Hi there,

Well mv should also move the hidden files because you are moving the folder. It is not possible that it is not moving the hidden files.

I have just tried moving mv /home/test /root/ and it does moves the hidden files.

rsync is something different it is usually used for backup purpose. For example you have set up /backup directory to backup your file system data.

If you set up a script to run rsync to copy the data from /test to /backup it will copy only copy the difference.

Suppose /test is your live directory which changes everyday by the users and they save their work their and on /backup you already have this directory backed up before. Then rsync will only copy over the difference that is there on /test and /backup.
 
Old 04-29-2011, 04:03 PM   #3
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 249

Original Poster
Rep: Reputation: 1
There is no problem when I use 'mv /inst /inst2'.
Then it copies everything perfectly but i have inst directory inside of inst2 directory.

I would like to move only content on inst dir into inst2 dir.
When I perform 'mv /inst/* /inst2' or 'mv /inst /inst2' it copies everything apart hidden files.

How to move only content of /inst dir also with hidden files ?

Last edited by drManhattan; 04-29-2011 at 04:15 PM.
 
Old 04-29-2011, 04:32 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Try mv /inst/*.* /inst2
 
Old 04-29-2011, 05:23 PM   #5
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 249

Original Poster
Rep: Reputation: 1
It doesn't work that way.
Code:
[root@centos11 ~]# mv /root/tests/*.* /tmp
mv: cannot stat `/root/tests/*.*': No such file or directory
 
Old 04-29-2011, 06:04 PM   #6
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

That is because there is either no file with the extension or no file with the name (without name file .bashrc). Linux interpret .bashrc as .bashrc extension.

You have to try that command accordingly. For example if in a directory you have following types of file:

Scenario 1:

1. /test contains only name.txt files then run mv -v /test/*.* /destination_partition/destination_folder.

Scenario 2:

2. /test contains only .extension files (like .bashrc) run mv -v /test/.* /destination_partition/destination_folder.

Scenario 3:

3. /test contains both files .extension and name.txt files run mv -v /test/*.* /destination_partition/destination_folder && mv -v /test/.* /destination_partition/destination_folder

I have added -v so that you can see the progress.

Last edited by T3RM1NVT0R; 04-29-2011 at 06:05 PM.
 
Old 04-29-2011, 06:20 PM   #7
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
Quote:
Originally Posted by drManhattan View Post
How to move only content of /inst dir also with hidden files ?
Why don't you use rsync?

# rsync -avp /inst/ /inst2/

Note the slash at /inst/.
I use rsync at all time, it's just faster.
 
Old 04-29-2011, 06:36 PM   #8
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
Quote:
Originally Posted by sibe View Post
Why don't you use rsync?

# rsync -avp /inst/ /inst2/

Note the slash at /inst/.
I use rsync at all time, it's just faster.
Hi Sibe,

I think that command will copy over the files but files will remain there on the source. What he is looking for is moving the files.
 
Old 04-29-2011, 10:09 PM   #9
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
--
Ah, you're right. Sorry.
 
  


Reply

Tags
cp, files, hidden, mv


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to rsync files on two servers that have two different file systems mrotsliah Linux - General 2 08-11-2010 03:29 PM
writing spec file for RPM to move files Help Me Linux - Newbie 2 05-08-2006 12:58 PM
Multiple Mounts for a device and move File systems louisb Linux - Enterprise 16 06-27-2005 05:43 PM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM
File Systems and Numerous files per directory dman65 Linux - General 1 10-06-2003 04:32 PM


All times are GMT -5. The time now is 11:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration