[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 1001- 2ch.scのread.cgiへ]
Update time : 11/05 07:14 / Filesize : 281 KB / Number-of Response : 1025
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

スレ立てるまでもない質問はここで 159匹目



200 名前:195 mailto:sage [2022/02/24(木) 21:57:06.88 ID:82W7j8jp.net]
# dest_dir の直下には、1つだけ解凍されたディレクトリがあると想定する
decomp_root_path = dest_dir.children[0]
#=> <Pathname: C:/Users/Owner/Documents/data/20220224_211030/z>

decomp_root_dir = decomp_root_path.basename.to_s # ディレクトリ名。z

# 末尾に、_out を加えた、ディレクトリ名。z_out
out_dir = decomp_root_dir + "_out"

# decomp_root_path の末尾に、_out を加えたパス
out_root_path = dest_dir + out_dir
#=> <Pathname: C:/Users/Owner/Documents/data/20220224_211030/z_out>

out_root_path.mkdir( ) # ディレクトリを作る
print "\n#{ out_root_path.to_s } フォルダを作りました\n\n"

# 絶対パスのディレクトリ名の後ろに、* を付けること!
# . で始まる、隠し directory, file を除く
decomp_root_path.glob( "**/*.{png,jpg,jpeg,gif,bmp,webp}" ) do |full_path|

# decomp_root_dirの部分だけを、_out を加えて、out_dir に変えたもの
out_full_path = out_root_path + full_path.relative_path_from( decomp_root_path )

dir = out_full_path.parent # ディレクトリ
# ディレクトリが存在しなければ、親ディレクトリも含めて作る。mkdir_p
dir.mkpath unless dir.directory?

# ここに、各画像ファイルの変換処理を書く!
end

次へ続く






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<281KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef