bash script move file to folders based in name
- by user289111
I hope you can help me...
I made a perl and bash script to make a backup of my firewalls and tranfers via tftp
#!/bin/sh
perl /deploy/scripts/backups/10.160.23.1.pl > /dev/null 2>&1
perl /deploy/scripts/backups/10.160.23.2.pl > /dev/null 2>&1
so this tranfers the file to my tftp directory /tftpboot/
ls -l /tftpboot/
total 532
-rw-rw-rw- 1 tftp tftp 209977 jun 6 14:01 10.160.23.1_20140606.cfg
-rw-rw-rw- 1 tftp tftp 329548 jun 6 14:02 10.160.23.2_20140606.cfg
my questions is how to improve my script to moving this files dynamically to another folder based on the name (in this case on the ip address)
for example:
10.160.23.1_20140606.cfg move to /deploy/backups/10.160.23.1/
is that the answer to this surely was on Google, but wanted to know if there was a particular solution to this request and also learn how to do :)
Thanks!