Tyro Posted January 1, 2005 Share Posted January 1, 2005 I wanted to make a bash script that would backup a dir, then move the backup to a deferent hdd for safekeeping.Did that all ok - borrowed and adjusted one from http://www.linuxplanet.com/linuxplanet/tutorials/5257/3/ Then I added the following to the end. mv -fv /home/steve/1backups/backup*.* /mnt/hdb3/steve/This works fine where a backup file is moved from hda6 to hdb3 as expected. But if i try to move the same file across the network to a windows machine - mv -fv /home/steve/1backups/backup*.* smb://downstairs/SharedDocs/It comes up with this error - mv: cannot move `/home/steve/1backups/backup-20050101.tgz' to `smb://downstairs/SharedDocs/backup-20050101.tgz': No such file or directoryI presume this is because of smb. Can anyone tell me how to do this correctly?Tyro :-) Quote Link to comment Share on other sites More sharing options...
Peachy Posted January 1, 2005 Share Posted January 1, 2005 Hmm,if you use the mv command and then use the mv command again on the same file(s) then you should get an error message because those files are no longer where they were originally since you just moved them. If you used cp for copy then you could use mv as the second command or use cp again. The other alternative is to adjust the second mv command to use as its source, the destination of the original command. I'm assuming that's what you did, to get the error message. Quote Link to comment Share on other sites More sharing options...
Tyro Posted January 1, 2005 Author Share Posted January 1, 2005 No you missunderstand, What I meant was If I use the line mv -fv /home/steve/1backups/backup*.* smb://downstairs/SharedDocs/ (this should move the file across the network) I get an error. Instead of - mv -fv /home/steve/1backups/backup*.* /mnt/hdb3/steve/ ( this moves the file between harddrives) where this works ok.I would prefer to move the file across the network as this would be safer as a backup. Tyro :-) Quote Link to comment Share on other sites More sharing options...
Bruno Posted January 1, 2005 Share Posted January 1, 2005 Hi TyroI know nothing about Samba . . but are you not supposed to log in to your samba share first ? Bruno. . . . . Quote Link to comment Share on other sites More sharing options...
linuxdude32 Posted January 2, 2005 Share Posted January 2, 2005 I've never tried it but I don't think mv recognizes things like smb:// or ftp:// etc. It's not that smart; it's only for drives. What you'd have to do is mount the remote Samba drive using smbmount in a /mnt/ location (or wherever you like) and then mv the file. Does that make sense? Quote Link to comment Share on other sites More sharing options...
ebrke Posted January 2, 2005 Share Posted January 2, 2005 (edited) You may have to play with this in a script. Doing it manually, I mounted the shared directory using this syntax: mount -t smbfs -o rw,username=ebrke //netbios-name/share-name /existing-mnt-pointYou're going to have to play around with ownership issues if you want to move rather than copy, but I was able to do it successfully after mounting the Samba share. Also, I'm going linux to linux rather than linux to windows, same owner issues may not exist going to a windows share, I don't know. Edited January 2, 2005 by ebrke Quote Link to comment Share on other sites More sharing options...
steel Posted January 5, 2005 Share Posted January 5, 2005 No you missunderstand, What I meant was If I use the line mv -fv /home/steve/1backups/backup*.* smb://downstairs/SharedDocs/ (this should move the file across the network) I get an error. Instead of - mv -fv /home/steve/1backups/backup*.* /mnt/hdb3/steve/ ( this moves the file between harddrives) where this works ok. I would prefer to move the file across the network as this would be safer as a backup. Tyro :-)ok i must of read this at least 5x and still dont know what you mean and why you would try to use mv to do that whats the matter with rsync command especially when it comes to do that job anyway i think you should check this outalso man rsync only way i know Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.