1. 程式人生 > >shell 將7天內更新的檔案複製到另外一個資料夾

shell 將7天內更新的檔案複製到另外一個資料夾

#!/bin/bash       
find . -type f -mtime -7 | while read f    
    do  
		filedir=`expr substr "$f" 2  ${#f}`
		oldfiledir='/var/www/html/tomtop.com1.7/media'${filedir}
		newfiledir='/sharefile/www/web/tomtop.com1.7/media'${filedir}
		echo ${oldfiledir}' was copy to '${newfiledir}
		mkdir -p -- "$(dirname -- "$newfiledir")" && cp -Rrf "$oldfiledir" "$newfiledir" ;
        #fulloldfiledir=`expr substr "$file" 16  ${#file}`
        #relativefiledir=`expr substr "$file" 44  ${#file}`
        #fullnewfiledir='/sharefile/images/img2.tomtop.com/'${relativefiledir}
        #fullnewfiledir2='/sharefile/www/web/tomtop.com1.7/'${relativefiledir}
        #echo $fulloldfiledir
        #echo $relativefiledir
        #echo $fullnewfiledir
        #echo "$fulloldfiledir  was write to file:$fullnewfiledir" >> /dev/shm/inotify.log 2>&1
        #mkdir -p -- "$(dirname -- "$fullnewfiledir")" && cp -Rrf "$fulloldfiledir" "$fullnewfiledir" ;
        #mkdir -p -- "$(dirname -- "$fullnewfiledir2")" && cp -Rrf "$fulloldfiledir" "$fullnewfiledir2" ;
        #php /var/www/html/tomtop.com1.7/tomtopdotcom_scripts/img2tomtopvarnishflush.php "$relativefiledir"
		#mkdir -p -- "$(dirname -- "$fullnewfiledir")" && cp -Rrf "$fulloldfiledir" "$fullnewfiledir" ;
		#/usr/bin/php -f /var/www/html/tomtop.com1.7/shell/GetProductReview.php reviewinfo
   done 

相關推薦

shell 7更新檔案複製另外一個資料

#!/bin/bash find . -type f -mtime -7 | while read f do filedir=`expr substr "$f"

linux 怎麼樣複製資料所有檔案到另一個資料

cp -Rf /home/user1/* /root/temp/將 /home/user1目錄下的所有東西拷到/root/temp/下而不拷貝user1目錄本身。即格式為:cp -Rf 原路徑/ 目的

使用VS的生成事件命令列指令生成的exe,dll檔案複製到指定資料

VS預生成事件命令列 和 生成後事件命令列 巨集說明 $(ConfigurationName)            當前專案配置的名稱(例如,“Debug|Any CPU”)。 $(OutDir)                              輸出檔案目錄的路徑,相對於專案目錄。這解

複製檔案到另一個資料

copy檔案到另一個目錄下 public static void main(String[] args) { File file = new File("E:\\830\\"); String fileName = "123456.csv";

用TC批量複製一個資料中的同名檔案

製作資料集的時候,有JPEGImages資料夾和Annotations資料夾,這兩個資料夾下遍的檔案相同部分只有檔名,而後綴不同,先從JPEGImages中挑去部分圖片,以及Annotations同對應的同名.xml檔案,但是如果每個資料夾都操作一遍費事費力,現有簡單方法如下

linux複製檔案到另一個資料

cp複製命令 ./qrcode_error_info.lua表示當前目錄下的qrcode_error_info.lua檔案 ../../common表示 上一次目錄/上一次目錄

matlab 移動(複製檔案到另一個資料

sourcePath = '.\Square_train'; targetPath = '.\Square_test'; fileList = dir(sourcePath); for k = 3 :5: length(fileList) movefile([sour

使用C++ 複製一個資料下的所有檔案到另一個資料

#include "Shellapi.h" #include "tchar.h" #pragma comment(lib,"shell32.lib") //告訴編譯器在編譯形成的.obj檔案和.exe檔案中新增一條資訊,使得連連結器在連結庫時去直接找shell32.lib這

python一個資料下圖片到另外一個資料

使用的是python的一個模組shutil。開始想用os.system(),但是好像不行 import shutil shutil.move('image/1.jpg','image1') 還有其他關於模組shutil的其他函式,可以參考部落格

一個shell指令碼一個檔案下超過100KB的檔案複製到另一個資料

指令碼編寫:         (0)建立的指令碼檔案,先用vi命令開啟,瞎寫一些東西 (推薦)         (1)第一行內容是固定的 #!/bin/sh         (2)涉及到的目錄,

SQL語句來查詢今天、昨天、7、30的數據,經典!

diff 指定 first 內容 輸出 har edi time nth ---恢復內容開始--- 今天的所有數據:select * from 表名 where DateDiff(dd,datetime類型字段,getdate())=0 昨天的所有數據:select *

SQL查詢今天、昨天、7、30 - 轉

mon getdate ont 註意 修改 get 當前時間 指定 body 今天的所有數據:select * from 表名 where DateDiff(dd,datetime類型字段,getdate())=0 昨天的所有數據:select * from 表名 w

【Sql Server函數】日期時間函數、日期查詢今天、昨天、7、30的數據

本周 varchar last 類型 nth weight 所有 convert ted 今天的所有數據:select * from 表名 where DateDiff(dd,datetime類型字段,getdate())=0 昨天的所有數據:select * from

laravel 專案靜態檔案,css、js、images 部署到七牛雲 CDN

專案升級,打算把 public 目錄下的 css、js、image等檔案,上傳到七牛雲,一直想搞來著,今天又想起來,正好 laravel 也從 5.2 升級到了 5.7,接下來把這邊一搞,專案就更加優化了。 接上篇文章: 使用 qshell 將本地檔案同步到七牛雲 https://blog.c

Sql Server日期查詢-SQL查詢今天、昨天、7、30

注: SQL查詢某一段的資料用的比較多,本人記性差,就只有轉載一下辣! 今天的所有資料:select * from 表名 where DateDiff(dd,datetime型別欄位,getdate())=0 昨天的所有資料:select * from 表名 where DateDiff(dd,d

linux查詢find命令及刪除7前的檔案

find ./ -mtime +5 |xargs rm -rf 語句寫法: find 對應目錄 -mtime +天數 -name "檔名" -exec rm -rf {} \; 例1:   find /usr/local/backups -mtime +10 -name "*.*" -exec

Sql(時間):日期查詢-SQL查詢今天、昨天、7、30

今天的所有資料:select * from 表名 where DateDiff(dd,datetime型別欄位,getdate())=0 昨天的所有資料:select * from 表名 where DateDiff(dd,datetime型別欄位,getdate())=1

SQL日期查詢-SQL查詢今天、昨天、7、30,年

近期程式開發中,需要對時間進行比較,此時需要用到SQL的時間查詢系列功能,綜合整理資料如下: 今天的所有資料:select * from 表名 where DateDiff(dd,datetime型別欄位,getdate())=0 昨天的所有資料:select * from&nbs

ubuntu下一個檔案複製到另一個資料複製出錯,原因是使用者對資料的許可權不夠

情況:在ubuntu系統下,想將一個檔案複製到/usr/local/etc/mini-ndn資料夾下,但是複製出錯,原因是使用者對這個資料夾的許可權不夠. 解決方法:提高使用者的許可權,使用以下程式碼 sudo chmod 777 /usr/local/etc/mini-ndn