[過去ログ] くだらねえ質問はここに書き込め! Part 238 (1002レス)
上下前次1-新
抽出解除 レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
839(2): 2020/01/08(水)03:27 ID:w8skh/lE(1/2) AAS
>>819
Ruby で作った。
DryRun なので、実際には実行されません!
require 'fileutils'
# 絶対パスの末尾に、*.txt などの拡張子も付ける。
# target は変更されるディレクトリで、non_target は変更されないディレクトリ
non_target_dir_with_ext = "C:/Users/Owner/Documents/a/*.txt"
target_dir_with_ext = "C:/Users/Owner/Documents/b/*.mp4"
# ディレクトリパスだけを取り出す
non_target_dir = File.dirname( non_target_dir_with_ext )
省3
840: 839 2020/01/08(水)03:28 ID:w8skh/lE(2/2) AAS
# そのディレクトリ内の全てのファイル名から、
# 拡張子を除いたファイル名をソートして、配列に入れて戻す
def collect_filenames( dir_path )
Dir.glob( dir_path )
.select { |full_path| File.file?( full_path ) } # ファイルのみ
.map { |full_path| File.basename( full_path, ".*" ) } # 拡張子を除いたファイル名
.sort
end
src_filenames = collect_filenames( target_dir_with_ext )
dest_filenames = collect_filenames( non_target_dir_with_ext )
省8
843: 2020/01/08(水)16:46 ID:owkw/mWp(1) AAS
>>839
> "C:/Users/Owner/Documents/ …
え?
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.029s