Jump to content

sync usb drive to folder


mifan
 Share

Recommended Posts

Dumb question: what happens when you want to delete a file?

If you delete it from one machine, and then rsync, it will copy it back again. If you delete it from the other machine, and then rsync, it will copy it again. I guess the only way to delete it is to make sure it's deleted from both sides before the rsync?

Link to comment
Share on other sites

Dumb question: what happens when you want to delete a file?

If you delete it from one machine, and then rsync, it will copy it back again. If you delete it from the other machine, and then rsync, it will copy it again. I guess the only way to delete it is to make sure it's deleted from both sides before the rsync?

That's a pretty smart question, actually. :D

 

You could use the --delete option. See: http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=r/rsync

 

--delete

 

Before transferring files from a source directory, delete any files from the destination directory that do not exist in the source directory.

Link to comment
Share on other sites

Dumb question: what happens when you want to delete a file?

If you delete it from one machine, and then rsync, it will copy it back again. If you delete it from the other machine, and then rsync, it will copy it again. I guess the only way to delete it is to make sure it's deleted from both sides before the rsync?

you can use the flag:

--delete				delete files that don't exist on sender

 

Edit: Ooops jboy was faster

Edited by Mhn
Link to comment
Share on other sites

Krusader has excellent directory sync facilities

 

 

Krusader Synchronizer

This function compares the left and the right panel directories and shows the difference between them. After selecting some options and the Compare function you can synchronize the files and directories. One panel could be an FTP server. Don't forget the Compare by content option if the file size stays equal. Choose Commands->Synchronize Directories or Ctrl+Y to start this feature. The colors are configurable.

Link to comment
Share on other sites

I have been using unison for this job for many years. It allows one to preview and correct the suggested synchronization. I.e., if a file was deleted/modified in one of the directories, you can decide whether you wanmt to delete/update it in another diresctory, or restore the original version.

Quite handy.

 

Dumb question: what happens when you want to delete a file?

If you delete it from one machine, and then rsync, it will copy it back again. If you delete it from the other machine, and then rsync, it will copy it again. I guess the only way to delete it is to make sure it's deleted from both sides before the rsync?

Link to comment
Share on other sites

You could use the --delete option.
Yeah, sure, but if you have a cron job set up to automatically run this rsync every night (in both directions, without the --delete option) then things will automatically get restored every time the rsync runs.

 

I like the sound of that interactive sync, where it gives you the choice. Also kdiff3 has some good compare functions, that's very useful for checking what's changed between two file trees. I don't use it for syncing but just for comparing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...