LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   rsync and hidden files (https://www.linuxquestions.org/questions/slackware-14/rsync-and-hidden-files-686123/)

eddygrinder 11-25-2008 07:26 PM

rsync and hidden files
 
Hello!
When i do rsync -avz /source/ /dest it kept appearing a lot of hidden files like .abc.pdf.167RAI.

I delete them using: find /dir -name '.*' -type f -print0 | xargs -0 /bin/rm -f
And when i rsync again the damn files appears in my drive!

Is this normal?

Thx a lot
EddY

rayfordj 11-25-2008 08:47 PM

Quote:

Originally Posted by eddygrinder (Post 3354427)
Is this normal?

Yes.

man rsync
You may be interested in the filter or exclude options of rsync.

xky 07-09-2009 02:22 PM

Quote:

Originally Posted by eddygrinder (Post 3354427)
Hello!
When i do rsync -avz /source/ /dest it kept appearing a lot of hidden files like .abc.pdf.167RAI.

I delete them using: find /dir -name '.*' -type f -print0 | xargs -0 /bin/rm -f
And when i rsync again the damn files appears in my drive!

Is this normal?

Thx a lot
EddY

Hi, I've the same problem, but I can't find a right solution. I've read man pages, and I think that exclude option and filters can be useful only if hidden files ar present in source directory, The problem is that hidden files are generated by rsync

Thanks for help

wadsworth 07-09-2009 06:29 PM

Hi,
rsync creates a temporary hidden file during a transfer,
but the file is renamed when the transfer is complete.

Common problem:
If you're syncing to or from FAT32 or NTFS,
you'll need to pass an extra switch to rsync; --modify-window=1
(disregard if FAT32/NTFS aren't involved) :)

xky 07-10-2009 12:49 AM

Quote:

Originally Posted by wadsworth (Post 3602714)
Hi,
rsync creates a temporary hidden file during a transfer,
but the file is renamed when the transfer is complete.

Common problem:
If you're syncing to or from FAT32 or NTFS,
you'll need to pass an extra switch to rsync; --modify-window=1
(disregard if FAT32/NTFS aren't involved) :)

thanks, I will try with this option

xky 07-10-2009 05:07 AM

Quote:

Originally Posted by xky (Post 3602946)
thanks, I will try with this option

nothing good!! :( I've tried with --modify-window=1 but the result is the same. I've seen that files generated in nas direcroty have a newer date, so the option -t don't preserve the original date

gargamel 07-10-2009 07:16 AM

From the fact that you tried the modify-window switch I conclude that, at least, either source or target are using some kind of FAT/NTFS filesystem.

If it's NTFS, ok. But if it's FAT: This has driven me nuts in the past many times. Because it is impossible to preserve filemodes and such, when FAT is involved. Other metadata, like access times, may be lost, also, after the transfer. And what really sucks, is that filenames appear correctly spelled on the screen, but are actually converted to 8.3 length and capital letters. Finally, there's no support for international characters.
And, BTW, things get really obscure, if you transfer between a remote drive and local one. In such a situation you will find out, that even within a Microsoft-only environment things aren't handled correctly. Suddenly you'll see lots of Tilde characters (~) in truncated file names, and so on.

But these are all restrictions of FAT, not of rsync, and it's just a guess that your problem may have to do with one or some of them.

But maybe, you can provide a little more detail, so someone around here might be able to help better than I can.

gargamel

eddygrinder 07-10-2009 11:50 AM

Hello!

I'm not an expert but i resolved my problem by creating two batch files:

1 - synchronize the tow directories: rsync -avz --exclude=".*" --no-group /home/grinder/escola/ /media/GRINDER/escola
2 - remove the hidden files: find /home/grinder/escola -name '.*' -type f -print0 | xargs -0 /bin/rm -f

The argument --exclude=".*" excludes the hidden files! So you don't have the hidden files synchronized

If you want to remove all hidden files created by rsync you can run 2

It may be the easiest way but it works...

I hope i could help...

cheers

xky 07-11-2009 03:36 AM

for eddygrinder:

Hidden files are not present in my source directory, but only in destination directory.


for gargamel:

My destination folder is a NAS disk that can be formatted by web interface only in fat32. I note that files take date form NAS time server, so files get nas date. I solved this problem with two commands:
Code:

\cp -u -p -f -r -v /[source]/ /[destination]
with cp command "-u" I update files from source to destination without a phisical copy everytime, but just with a comparison.And "-p" option which preserve file date,owner and group.

Code:

rsync -a -h -v --delete-after /[source] /[destination]
After this, I execute rsync command because cp command don't remove files that has been removed by the user from source, rsync find out files with the same date of source files (thanks to cp -p) and only compare files and remove old files from destination

With this two operation I can simulate more or less a good rsync made with ntfs partition

eddygrinder 07-22-2009 04:10 PM

Ok, my mistake!

In the beginning i remove the hidden files in both source and destination directories to have them free of hidden files!
After rsync i clean the destination dir with:
find /destination/directory -name '.*' -type f -print0 | xargs -0 /bin/rm -f

Sorry about that!

Cheers
EddY


All times are GMT -5. The time now is 05:56 AM.