# Parallel move keeping folder structure along with files in it

**URL:** <https://community.unix.com/t/parallel-move-keeping-folder-structure-along-with-files-in-it/367080>\
**Category:** Shell Programming and Scripting\
**Created:** [June 16, 2017, 4:26pm UTC](https://community.unix.com/t/parallel-move-keeping-folder-structure-along-with-files-in-it/367080 "2017-06-16T16:26:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmccabe](https://community.unix.com/letter_avatar/cmccabe/32/6_449c533f586939b6e5f246632a46421f.png) [@cmccabe](https://community.unix.com/u/cmccabe)\
**Post date:** [June 16, 2017, 4:26pm UTC](https://community.unix.com/t/parallel-move-keeping-folder-structure-along-with-files-in-it/367080/1 "2017-06-16T16:26:06Z")

</div>

The below will move all the files in the directory `dir` to the destination using `parallel` and create a log, however will not keep them in the directory. I have tried `mkdir -p` but that does not seem to work or at least I can not seem to get it (as it deletes others files when I use it). What is the correct way to move the 3 files into the same directory? Thank you :).

```nohighlight
dir="/home/cmccabe/Downloads/snp"
cd "$dir"
parallel -j10 --progress mv -v {} /home/cmccabe/Desktop/indel/ ::: * > /home/cmccabe/medex.logs/archive.log

```

Folder structure:

```nohighlight
FolderName --- dir
|
file1
file2
file3

```

Desired after move:

```nohighlight
FolderName
|
3 files in it

```

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_449c533f586939b6e5f246632a46421f.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [June 16, 2017, 4:59pm UTC](https://community.unix.com/t/parallel-move-keeping-folder-structure-along-with-files-in-it/367080/2 "2017-06-16T16:59:16Z")

</div>

Your hard drive does not work in parallel. There is no point or benefit in running cp, mv, rsync, rm, rmdir, etc in parallel. They will still have to wait for each other. Trying to run them in parallel will actually slow it down and cause fragmentation. Don't do it.

Running tar in parallel - as in your other thread - only worked because bzip2 is so slow that the disk was waiting for the CPU, not vice versa. That's an unusual situation and not at all true of basic file utilities.

---

<div class="post-metadata">

**Author:** ![cmccabe](https://community.unix.com/letter_avatar/cmccabe/32/6_449c533f586939b6e5f246632a46421f.png) [@cmccabe](https://community.unix.com/u/cmccabe)\
**Post date:** [June 16, 2017, 5:33pm UTC](https://community.unix.com/t/parallel-move-keeping-folder-structure-along-with-files-in-it/367080/3 "2017-06-16T17:33:40Z")

</div>

Thank you very much :).
