このファイル操作ツールでは、以下のコマンドをサポートしています:
- reverse: ファイル内容を逆順にして、別のファイルとして保存する。
- copy: ファイル内容を別のファイルにコピーする。
- duplicate-contents: ファイル内容を指定回数繰り返して複製する。
- replace-string: ファイル内の特定の文字列を別の文字列に置き換える。
- Python 3.6 以上
- ファイルシステムの読み書き権限
このリポジトリをクローンまたはダウンロードして、ローカルマシンに保存してください。
コマンドラインから file_manipulator.py
を実行してください。サポートされているコマンドは次のとおりです:
- reverse:
python3 file_manipulator.py reverse <input_filepath> <output_filepath>
- copy:
python3 file_manipulator.py copy <input_filepath> <output_filepath>
- duplicate-contents:
python3 file_manipulator.py duplicate-contents <input_filepath> <repeat_integer>
repeat_integer
は繰り返す回数を整数で指定してください。
- replace-string:
python3 file_manipulator.py replace-string <input_filepath> <find_string> <replace_string>
- 検索文字列(
find_string
)と置換文字列(replace_string
)の両方を必ず指定してください。 - 空白を含む文字列は、次のように指定してください:
'find1 find2'
- 置換文字列(
replace_string
)を''
ように指定すると、ファイルの内容からすべての検索文字列を削除することができます。
- 指定した出力ファイルパス(
output_filepath
) が無効またはアクセス不可の場合、output.txt
という名前で同じディレクトリに保存されます。