lib/qdumpfs.rb in qdumpfs-0.9.0 vs lib/qdumpfs.rb in qdumpfs-1.0.0
- old
+ new
@@ -135,15 +135,21 @@
end
chown_if_root(type, src, today)
end
def filecount(dir)
- pscmd = 'Get-ChildItem -Recurse -File | Measure-Object | %{$_.Count}'
- cmd = "powershell -Command \"#{pscmd}\""
- result = nil
- Dir.chdir(dir) do
- result = `#{cmd}`
+ result = '0'
+ if windows?
+ pscmd = 'Get-ChildItem -Recurse -File | Measure-Object | %{$_.Count}'
+ cmd = "powershell -Command \"#{pscmd}\""
+ result = nil
+ Dir.chdir(dir) do
+ result = `#{cmd}`
+ result.chomp!
+ end
+ else
+ result = `find #{dir} | wc -l`
result.chomp!
end
result.to_i
end
@@ -219,10 +225,10 @@
def sync_latest(src, dst, base = nil)
# pdumpfsのバックアップフォルダを同期する
#コピー元のスナップショット
src_snapshots = BackupDir.scan_backup_dirs(src)
- @opt.detect_keep_dirs(src_snapshots)
+ @opt.detect_expire_dirs(src_snapshots)
# コピー先の最新スナップショット
dst_snapshots = BackupDir.scan_backup_dirs(dst)
dst_snapshot = dst_snapshots[-1]