Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #181006 > unrolled thread
| Started by | Long Wind <longwind2009@gmail.com> |
|---|---|
| First post | 2017-05-14 23:00 +0200 |
| Last post | 2017-05-15 14:50 +0200 |
| Articles | 8 — 6 participants |
Back to article view | Back to linux.debian.user
how to copy files Long Wind <longwind2009@gmail.com> - 2017-05-14 23:00 +0200
Re: how to copy files Lisi Reisz <lisi.reisz@gmail.com> - 2017-05-14 23:50 +0200
Re: how to copy files Dan Ritter <dsr@randomstring.org> - 2017-05-15 01:40 +0200
Re: how to copy files Long Wind <longwind2009@gmail.com> - 2017-05-15 05:20 +0200
Re: how to copy files Dejan Jocic <jodejka@gmail.com> - 2017-05-15 09:20 +0200
Re: how to copy files Felix Dietrich <felix.dietrich@sperrhaken.name> - 2017-05-20 15:50 +0200
Re: how to copy files Dejan Jocic <jodejka@gmail.com> - 2017-05-20 16:20 +0200
Re: how to copy files Greg Wooledge <wooledg@eeg.ccf.org> - 2017-05-15 14:50 +0200
| From | Long Wind <longwind2009@gmail.com> |
|---|---|
| Date | 2017-05-14 23:00 +0200 |
| Subject | how to copy files |
| Message-ID | <tH8Mp-6zv-13@gated-at.bofh.it> |
I have a folder in hard drive and a backup of it is made in a USB disk Now some new files are added to the folder in hard drive how to make the folder in USB disk the same as in hard drive? I want a program that can check the two folders if file size and file name are same, they are regarded as same if not, update is needed I have try rsync, but can't find such options
[toc] | [next] | [standalone]
| From | Lisi Reisz <lisi.reisz@gmail.com> |
|---|---|
| Date | 2017-05-14 23:50 +0200 |
| Message-ID | <tH9yN-7cD-7@gated-at.bofh.it> |
| In reply to | #181006 |
On Sunday 14 May 2017 21:57:35 Long Wind wrote: > I have a folder in hard drive and a backup of it is made in a USB disk > Now some new files are added to the folder in hard drive > how to make the folder in USB disk the same as in hard drive? > > I want a program that can check the two folders > if file size and file name are same, they are regarded as same > if not, update is needed > > I have try rsync, but can't find such options cp -Rpu /home/. /backup/ will copy only new stiff, but all new stuff. That is for everything in home. But you could do the same for one folder or sub-folder, or one user. Lisi
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2017-05-15 01:40 +0200 |
| Message-ID | <tHbhf-8tb-5@gated-at.bofh.it> |
| In reply to | #181006 |
On Mon, May 15, 2017 at 04:57:35AM +0800, Long Wind wrote:
> I have a folder in hard drive and a backup of it is made in a USB disk
> Now some new files are added to the folder in hard drive
> how to make the folder in USB disk the same as in hard drive?
>
> I want a program that can check the two folders
> if file size and file name are same, they are regarded as same
> if not, update is needed
>
> I have try rsync, but can't find such options
That's the default for rsync.
rsync /path/to/originals/ /path/to/copies/
add -r for recursion into subdirectories
add -v for verbosity
add -a (archive) to keep ownership, groups, and permissions
identical. That usually needs root privileges.
There are a lot of other options to rsync; you can have
unrecognized files in the destination ignored or deleted.
You can require the contents of all files to match, rather than
just their name and size.
You can have special exclusions and inclusions.
If you need changes on both directories to be reflected in each
other, you want unison instead of rsync.
-dsr-
[toc] | [prev] | [next] | [standalone]
| From | Long Wind <longwind2009@gmail.com> |
|---|---|
| Date | 2017-05-15 05:20 +0200 |
| Message-ID | <tHeIa-2lr-7@gated-at.bofh.it> |
| In reply to | #181010 |
[Multipart message — attachments visible in raw view] — view raw
archive just means that? Thank Dan Ritter! l will try it later on.
[toc] | [prev] | [next] | [standalone]
| From | Dejan Jocic <jodejka@gmail.com> |
|---|---|
| Date | 2017-05-15 09:20 +0200 |
| Message-ID | <tHisq-4X0-9@gated-at.bofh.it> |
| In reply to | #181012 |
On 15-05-17, Long Wind wrote: > archive just means that? > Thank Dan Ritter! > l will try it later on. What you probably want is: rsync -av /path/to/original/folder /path/to/backup With this command on your backup rsync will make folder named as folder in your original path under backup. Notice that there is no need for those / on the end of paths. Also, you will not need root permission for your home folder backups with any combination of options for rsync.
[toc] | [prev] | [next] | [standalone]
| From | Felix Dietrich <felix.dietrich@sperrhaken.name> |
|---|---|
| Date | 2017-05-20 15:50 +0200 |
| Message-ID | <tJcVA-28c-15@gated-at.bofh.it> |
| In reply to | #181016 |
Dejan Jocic <jodejka@gmail.com> writes:
> rsync -av /path/to/original/folder /path/to/backup
>
> Notice that there is no need for those / on the end of paths.
Rsync actually treats a trailing newline on the source path specially;
quoted from the man page:
A trailing slash on the source changes this behavior to avoid
creating an additional directory level at the destination. You
can think of a trailing / on a source as meaning "copy the con‐
tents of this directory" as opposed to "copy the directory by
name" […]
--
Felix Dietrich
[toc] | [prev] | [next] | [standalone]
| From | Dejan Jocic <jodejka@gmail.com> |
|---|---|
| Date | 2017-05-20 16:20 +0200 |
| Message-ID | <tJdoC-2xE-3@gated-at.bofh.it> |
| In reply to | #181146 |
On 20-05-17, Felix Dietrich wrote: > Dejan Jocic <jodejka@gmail.com> writes: > > > rsync -av /path/to/original/folder /path/to/backup > > > > Notice that there is no need for those / on the end of paths. > > Rsync actually treats a trailing newline on the source path specially; > quoted from the man page: > > A trailing slash on the source changes this behavior to avoid > creating an additional directory level at the destination. You > can think of a trailing / on a source as meaning "copy the con‐ > tents of this directory" as opposed to "copy the directory by > name" […] > > -- > Felix Dietrich > Yup, I know it. But OP asked for copy of original folder to backup folder. Not for copy of contents of original folder to some backup folder, in which case you would use trailing slash. Or at least that is how I've understood his question.
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2017-05-15 14:50 +0200 |
| Message-ID | <tHnBL-8iJ-13@gated-at.bofh.it> |
| In reply to | #181006 |
On Mon, May 15, 2017 at 04:57:35AM +0800, Long Wind wrote: > I have a folder in hard drive and a backup of it is made in a USB disk What type of file system is on the USB disk? For backing up files from a Unix file system, you really want a Unix file system on the target device, not a FAT32 or NTFS file system. > Now some new files are added to the folder in hard drive > how to make the folder in USB disk the same as in hard drive? cd /source && rsync -a . /target > I want a program that can check the two folders > if file size and file name are same, they are regarded as same > if not, update is needed Wait. Please explain this part in more detail. Let's say you have a file named thesis.txt on your hard drive, and it is 4 bytes long, containing "foo" plus newline. You copy this to the USB disk. Now you edit thesis.txt on the hard drive and change the content to "bar" plus newline. Both copies of thesis.txt have the same name and the same size. But the copy on the hard drive has a newer timestamp, and it has different CONTENT. Are you saying that you want rsync to IGNORE the different timestamp and the different content, and skip this file, just because it has the same size as the one on the USB disk? Why would you want this behavior?
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web