Results 1 to 3 of 3
I have switch config files tftpd into a directory /tftpboot/
files are name as such idf1c-1.20090602.cfg etc.....
hostname.todaysdate.cfg
I started with a bash script essentially creating a directory with Todays ...
- 06-04-2009 #1Just Joined!
- Join Date
- Feb 2007
- Posts
- 2
Script to Move files like this??
I have switch config files tftpd into a directory /tftpboot/
files are name as such idf1c-1.20090602.cfg etc.....
hostname.todaysdate.cfg
I started with a bash script essentially creating a directory with Todays date and I want to move the config files with todays date in to the correct directory? I'm stuck on the mv cmd/// How can i in the script check in the file name for todays date ??
Possibly using find . ??
Thanks
- 06-04-2009 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
To produce the date in that format you can use
To do that in another command you can enclose itCode:date +%Y%m%d
Or better, set it in a variable and then have it availableCode:mkdir $(date +%Y%m%d) mv *$(date +%Y%m%d).cfg $(date +%Y%m%d)/
Code:dte=$(date +%Y%m%d) mkdir $dte mv *"$dte".cfg $dte/
- 06-04-2009 #3Just Joined!
- Join Date
- Feb 2007
- Posts
- 2
Dang that's quick...let me check it out..
Thanks


Reply With Quote