質問するログイン新規登録

質問編集履歴

3

回答いただいた方法を試した結果の追記

2021/04/12 04:38

投稿

mayuneco222
mayuneco222

スコア12

title CHANGED
File without changes
body CHANGED
@@ -71,6 +71,17 @@
71
71
  tar -zcvf $dirpath/$filename -C / $backupfolder
72
72
  tar -zcvf $dirpath/$filename $backupfolder
73
73
 
74
+ 回答いただいた
75
+ tar -zcvf $dirpath/$filename new -C $backupfolder
76
+ では、エラーが表示される。
77
+
78
+ ```sh
79
+ tar: The following options were used after any non-optional arguments in archive create or update mode. These options are positional and affect only arguments that follow them.
80
+ Please, rearrange them properly.
81
+ tar: -C `/home/user/folder/new' has no effect
82
+ ```
83
+
84
+
74
85
  ### 補足情報
75
86
 
76
- 追加依頼などあればここに記載します。
87
+ 補足などあればここに記載します。

2

shパスが間違っていたのを修正

2021/04/12 04:38

投稿

mayuneco222
mayuneco222

スコア12

title CHANGED
File without changes
body CHANGED
@@ -51,7 +51,7 @@
51
51
 
52
52
  # ファイル名を定義(名前と年月日時分をファイル名にする)
53
53
  mydate=`date +%y%m%d%H%M%S`
54
- filename=$target"world_bkup_$mydate.tar.gz"
54
+ filename=$target"datebkup_$mydate.tar.gz"
55
55
 
56
56
  #backup実行
57
57
  tar -zcvf $dirpath/$filename $backupfolder

1

誤字修正

2021/04/12 04:25

投稿

mayuneco222
mayuneco222

スコア12

title CHANGED
File without changes
body CHANGED
@@ -16,9 +16,9 @@
16
16
 
17
17
  ### 希望の構成
18
18
 
19
- /home/user/folder/new というパスのnewフォルダにあるファイルのみを、
19
+ /home/user/folder というパスのnewフォルダにあるファイルのみを、
20
20
  backup_yymmddhhmmss.tar.gzという名前でバックアップしたい。
21
- *圧縮フォルダ内はnewフォルダのみにしたい。
21
+ *圧縮フォルダ内はnewフォルダのみにしたい。
22
22
 
23
23
  今の状況:
24
24
  backup_yymmddhhmmss.tar.gzという名前で圧縮フォルダは作れている。