Shell script to copy files from one location to another location and rename add the current date to every file

前端 未结 6 496
温柔的废话
温柔的废话 2021-01-30 04:46

I have a folder in my server which contains some files. These are automated that means everyday we get new files automatically which will overwrite the old ones. So want to take

6条回答
  •  走了就别回头了
    2021-01-30 05:01

    You can be used this step is very useful:

    for i in `ls -l folder1 | grep -v total | awk '{print $ ( ? )}'`
    do
       cd folder1
       cp $i folder2/$i.`date +%m%d%Y`
    done
    

提交回复
热议问题