My folder structure is like this:
/volume1
/photoTest
/folderA
/@eaDir
/eaDir_tmp
/folderB
/@eaDir
/eaDir_tmp
/folder with space
/@eaDir
/eaDir_tmp
What I'm trying to do is copy files from each eaDir_tmp
to their respective @eaDir
folder.
I was able to get it going via:
for a in $(find /volume1/photoTest -type d -name eaDir_tmp); do rsync -vhar --chmod=a+rwx $a/ $a/../@eaDir; done;
until I hit the folder with spaces. The above script simply craps out.
After lots of googling, I tried:
find /volume1/photoTest -type d -name eaDir_tmp -print0 | xargs -0 rsync -vhra --chmod=a+rwx {} {}/../@eaDir
Dry run of this command runs without issues. But the actual run gets stuck after printing this.
sending incremental file list
@eaDir/subdir1/
And gets stuck thereon.
ps -elf | grep rsync
shows bunch of rsync processes on wait
and poll_s
state.
Does anyone have any idea what's going on? And what the solution might be?
Update: Some clarification based on the comment:
- Move or Copy? Well the ultimate goal is to "move". But I'd like to know how to copy as well.
- What's going on - yes I'd like to know what's going on and why my commands are not working as expected. I'm hoping to learn something as I'm not a regular linux user.
- What the solution might be? Well, I'd like to know this too. :)
- What's inside
eaDir
folders? More folders, and then some files inside them. If it helps, the whole thing started with this: https://github.com/mbrrg/synology-thumbgen. The author suggests to delete existing@eaDir
folders and simply renameeaDir_tmp
. But I can't do that because existing folders contains files that I'd like to keep. I can explain but I think that'll muddy the question further. execdir
works - in the sense it doesn't say invalid argument or throw any error. But it doesn't achieve the goal - i.e. copy the files correctly.- How rich is my
find
? This is inside my Synology NAS, which I think is running BusyBox? Not sure though. How do I find out? - If destination files exists, then I'd like to overwrite it if source is newer. Otherwise not.
eaDir_tmp
directories? If so, what do you want to do with them and their contents? What if there is already a file in@eaDir
with the same name as the file to be copied? Can you tell how rich in options is yourfind
? Does it understand non-POSIX-execdir
option?