![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using Rename to move files | snufse | UNIX for Dummies Questions & Answers | 1 | 04-09-2008 09:57 AM |
| Find, Append, Move & Rename Multiple Files | Trapper | Shell Programming and Scripting | 5 | 08-30-2007 04:39 AM |
| trying to rename the files in dir | hankooknara | Shell Programming and Scripting | 8 | 07-02-2007 12:36 AM |
| Move and rename files in seq. with padded digits | rocinante | Shell Programming and Scripting | 9 | 06-09-2007 07:37 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Move files and rename ??
1. If I have a file-yyyymmdd.dat in a directory DATA1, then how do I move this file to directory DATA2 and the file name change to file-yyyymmdd.dat.currenttime
I can manual do this $mv fileA-yyyymmdd.dat ./DATA2/fileA-yyyymmdd.dat.`date +%Y%m%d%H%M%S` but how do I move all of the files in this directory to new DATA2 and rename it with an extension currenttime like file-yyyymmdd.dat..`date +%Y%m%d%H%M%S` I dont want to do mannual one by one . 2. If I want to move all file older than file-20060320.dat to DATA2 then what should I do with korn shell. Thanks . |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
Code:
for file in *.dat
do
mv "${file}" ./DATA2/"${file}".`date +%Y%m%d%H%M%S`
done
Quote:
|
||||
| Google The UNIX and Linux Forums |