I've never had this problem: I have a few numerically numbered folders so I can loop through the files or even use parallelisation without worrying about all the file names being totally different. 

In this case, I separated all of my files into folders labelled `sample_1` to `sample_18` and used a *super simple* for loop:

```
for i in {1..18};
do
  cd sample_${i}
  mv *.fa sample_${i}.fa
  mv *.gff sample_${i}.gff
  mv *.bam sample_${i}.bam
  mv *.sam sample_${i}.sam
  cd ..
done

```

It works fine for 1-9 and then doesn't work in the double digits. It will literally give the error that the directory sample\_10 doesn't exist. I ventured it had something to do with bash thinking it was 1 and then 0 instead of 10 when I named the directories but I honestly don't know how to fix it. Anyone have any ideas?

Edit:

Showing what an ll command produces. All the directories are there.

```
-rw-rw---- 1 anm5579 mls164_collab  644 Sep 18 11:18 contentsInfo
-rw-rw---- 1 anm5579 mls164_collab   44 Sep 27 16:07 fixdata.sh
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_1
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 21 17:08 sample_10
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 18 10:59 sample_11
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 20 11:11 sample_12
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 21 17:12 sample_13
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 18 11:12 sample_14
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 18 11:11 sample_15
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 21 10:40 sample_16
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 20 11:08 sample_17
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 18 11:11 sample_18
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_2
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_3
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_4
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_5
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_6
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_7
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_8
drwxrws--- 2 anm5579 mls164_collab 4096 Sep 27 15:59 sample_9

```

Error produced is just no directory found for samples 10-18.

Showing what hexdump produces with: `echo sample_* | hexdump -C`:

```
00000000  73 61 6d 70 6c 65 5f 31  20 73 61 6d 70 6c 65 5f  |sample_1 sample_|
00000010  31 30 20 73 61 6d 70 6c  65 5f 31 31 20 73 61 6d  |10 sample_11 sam|
00000020  70 6c 65 5f 31 32 20 73  61 6d 70 6c 65 5f 31 33  |ple_12 sample_13|
00000030  20 73 61 6d 70 6c 65 5f  31 34 20 73 61 6d 70 6c  | sample_14 sampl|
00000040  65 5f 31 35 20 73 61 6d  70 6c 65 5f 31 36 20 73  |e_15 sample_16 s|
00000050  61 6d 70 6c 65 5f 31 37  20 73 61 6d 70 6c 65 5f  |ample_17 sample_|
00000060  31 38 20 73 61 6d 70 6c  65 5f 32 20 73 61 6d 70  |18 sample_2 samp|
00000070  6c 65 5f 33 20 73 61 6d  70 6c 65 5f 34 20 73 61  |le_3 sample_4 sa|
00000080  6d 70 6c 65 5f 35 20 73  61 6d 70 6c 65 5f 36 20  |mple_5 sample_6 |
00000090  73 61 6d 70 6c 65 5f 37  20 73 61 6d 70 6c 65 5f  |sample_7 sample_|
000000a0  38 20 73 61 6d 70 6c 65  5f 39 0a                 |8 sample_9.|
000000ab

```