1

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 rename eaDir_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.
3
  • Is your question "what's going on?" or "what the solution might be?". These are different questions. The title says "move", the question body says "copy". Please make up your mind. Are there subdirectories under 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 your find? Does it understand non-POSIX -execdir option? Commented Dec 30, 2017 at 0:58
  • @KamilMaciorowski Added answers to your questions. Hope that helps.
    – Mrchief
    Commented Dec 30, 2017 at 2:41
  • Posted this in linux SE: unix.stackexchange.com/questions/83711/…
    – Mrchief
    Commented Dec 31, 2017 at 7:28

1 Answer 1

0

Not sure why rsync gets stuck. but I was able to make some progress using 2 commands:

First, copy all files via:

find /volume1/photo -type d -name eaDir_tmp -exec cp -a -t {}/../@eaDir {}/. \;

Second, change file permissions:

find /volume1/photo -type d -name @eaDir -exec chmod 777 {} -R \;

Not only is this clumsy and slow, but this feels like I'm dealing with MS-DOS. Where are the linux gurus?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .